1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3
* ***** BEGIN LICENSE BLOCK *****
4
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
* The contents of this file are subject to the Mozilla Public License Version
7
* 1.1 (the "License"); you may not use this file except in compliance with
8
* the License. You may obtain a copy of the License at
9
* http://www.mozilla.org/MPL/
11
* Software distributed under the License is distributed on an "AS IS" basis,
12
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
* for the specific language governing rights and limitations under the
16
* The Original Code is Mozilla Communicator client code, released
19
* The Initial Developer of the Original Code is
20
* Netscape Communications Corporation.
21
* Portions created by the Initial Developer are Copyright (C) 1998
22
* the Initial Developer. All Rights Reserved.
26
* Alternatively, the contents of this file may be used under the terms of
27
* either of the GNU General Public License Version 2 or later (the "GPL"),
28
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
* in which case the provisions of the GPL or the LGPL are applicable instead
30
* of those above. If you wish to allow use of your version of this file only
31
* under the terms of either the GPL or the LGPL, and not to allow others to
32
* use your version of this file under the terms of the MPL, indicate your
33
* decision by deleting the provisions above and replace them with the notice
34
* and other provisions required by the GPL or the LGPL. If you do not delete
35
* the provisions above, a recipient may use your version of this file under
36
* the terms of any one of the MPL, the GPL or the LGPL.
38
* ***** END LICENSE BLOCK ***** */
41
* Test interfaces that inherit from interfaces other than nsISupports
42
* and classes that inherit from multiple interfaces.
44
* See xpctest_multiple.idl and xpctest_multiple.cpp.
48
StartTest( "Interfaces that inherit from interfaces other than nsISupports" );
53
function SetupTest() {
55
iChild = Components.interfaces.nsIXPCTestChild3;
56
iParentOne = Components.interfaces.nsIXPCTestParentOne;
58
CONTRACTID = "@mozilla.org/js/xpc/test/Child3;1";
59
cChild = Components.classes[CONTRACTID].createInstance();
60
CONTRACTID = "@mozilla.org/js/xpc/test/ParentOne;1";
61
cParentOne = Components.classes[CONTRACTID].createInstance();
63
child = cChild.QueryInterface(iChild);
64
parentOne = cParentOne.QueryInterface(iParentOne);
69
"Setting up the test",
71
"FAILED: " + e.message +" "+ e.location +". ");
75
function AddTestData() {
76
// child should have all the properties and methods of parentOne
79
for ( p in parentOne ) parentOneProps[p] = true;
80
for ( p in child ) if ( parentOneProps[p] ) parentOneProps[p] = false;
82
for ( p in parentOneProps ) {
86
"child has property " + p,
88
(parentOneProps[p] ? false : true )
91
if ( p.match(/Method/) ) {
94
"@mozilla.org/js/xpc/test/Child3;1 method",
97
} else if (p.match(/Attribute/)) {
100
"@mozilla.org/js/xpc/test/Child3;1 attribute",
106
for ( p in parentOneProps ) {
107
if ( parentOneProps[p] = true )
112
"child has parentOne properties?",
118
"child has property " + p,
120
(child[p] ? true : false )
123
if ( p.match(/Method/) ) {
126
"@mozilla.org/js/xpc/test/Child3;1 method",
129
} else if (p.match(/Attribute/)) {
132
"@mozilla.org/js/xpc/test/Child3;1 attribute",