1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
/* A regression test for bug 794316 */
13
static PRIOMethods dummyMethods;
17
PRDescIdentity topId, middleId, bottomId;
18
PRFileDesc *top, *middle, *bottom;
21
topId = PR_GetUniqueIdentity("top");
22
middleId = PR_GetUniqueIdentity("middle");
23
bottomId = PR_GetUniqueIdentity("bottom");
25
top = PR_CreateIOLayerStub(topId, &dummyMethods);
26
middle = PR_CreateIOLayerStub(middleId, &dummyMethods);
27
bottom = PR_CreateIOLayerStub(bottomId, &dummyMethods);
30
PR_PushIOLayer(fd, PR_TOP_IO_LAYER, middle);
31
PR_PushIOLayer(fd, PR_TOP_IO_LAYER, top);
35
bottom = middle->lower;
37
/* Verify that the higher pointers are correct. */
38
if (middle->higher != top) {
39
fprintf(stderr, "middle->higher is wrong\n");
40
fprintf(stderr, "FAILED\n");
43
if (bottom->higher != middle) {
44
fprintf(stderr, "bottom->higher is wrong\n");
45
fprintf(stderr, "FAILED\n");
49
top = PR_PopIOLayer(fd, topId);
53
bottom = middle->lower;
55
/* Verify that the higher pointer is correct. */
56
if (bottom->higher != middle) {
57
fprintf(stderr, "bottom->higher is wrong\n");
58
fprintf(stderr, "FAILED\n");
62
middle = PR_PopIOLayer(fd, middleId);
64
if (fd->identity != bottomId) {
65
fprintf(stderr, "The bottom layer has the wrong identity\n");
66
fprintf(stderr, "FAILED\n");