OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var util = {}; | 5 var util = {}; |
6 var embedder = {}; | 6 var embedder = {}; |
7 embedder.baseGuestURL = ''; | 7 embedder.baseGuestURL = ''; |
8 embedder.emptyGuestURL = ''; | 8 embedder.emptyGuestURL = ''; |
9 embedder.windowOpenGuestURL = ''; | 9 embedder.windowOpenGuestURL = ''; |
10 embedder.noReferrerGuestURL = ''; | 10 embedder.noReferrerGuestURL = ''; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 | 62 |
63 embedder.test.assertFalse = function(condition) { | 63 embedder.test.assertFalse = function(condition) { |
64 if (condition) { | 64 if (condition) { |
65 console.log('assertion failed: false != ' + condition); | 65 console.log('assertion failed: false != ' + condition); |
66 embedder.test.fail(); | 66 embedder.test.fail(); |
67 } | 67 } |
68 }; | 68 }; |
69 | 69 |
70 // Tests begin. | 70 // Tests begin. |
71 function testAppViewBasic(appToEmbed) { | 71 function testAppViewWithUndefinedDataShouldSucceed(appToEmbed) { |
72 var appview = new AppView(); | 72 var appview = new AppView(); |
73 LOG('appToEmbed ' + appToEmbed); | 73 LOG('appToEmbed ' + appToEmbed); |
74 // Step 1: Attempt to connect to a non-existant app. | 74 // Step 1: Attempt to connect to a non-existant app. |
75 LOG('attempting to connect to non-existant app.'); | 75 LOG('attempting to connect to non-existant app.'); |
76 appview.connect('abc123', {}, function(success) { | 76 appview.connect('abc123', undefined, function(success) { |
77 // Make sure we fail. | 77 // Make sure we fail. |
78 if (success) { | 78 if (success) { |
79 embedder.test.fail(); | 79 embedder.test.fail(); |
80 return; | 80 return; |
81 } | 81 } |
82 LOG('failed to connect to non-existant app.'); | 82 LOG('failed to connect to non-existant app.'); |
83 LOG('attempting to connect to known app.'); | 83 LOG('attempting to connect to known app.'); |
84 // Step 2: Attempt to connect to an app we know exists. | 84 // Step 2: Attempt to connect to an app we know exists. |
85 appview.connect(appToEmbed, {}, function(success) { | 85 appview.connect(appToEmbed, undefined, function(success) { |
86 // Make sure we don't fail. | 86 // Make sure we don't fail. |
87 if (!success) { | 87 if (!success) { |
88 embedder.test.fail(); | 88 embedder.test.fail(); |
89 return; | 89 return; |
90 } | 90 } |
91 embedder.test.succeed(); | 91 embedder.test.succeed(); |
92 }); | 92 }); |
93 }); | 93 }); |
94 document.body.appendChild(appview); | 94 document.body.appendChild(appview); |
95 }; | 95 }; |
(...skipping 23 matching lines...) Expand all Loading... |
119 if (!success) { | 119 if (!success) { |
120 embedder.test.fail(); | 120 embedder.test.fail(); |
121 return; | 121 return; |
122 } | 122 } |
123 embedder.test.succeed(); | 123 embedder.test.succeed(); |
124 }); | 124 }); |
125 document.body.appendChild(appview); | 125 document.body.appendChild(appview); |
126 }; | 126 }; |
127 | 127 |
128 embedder.test.testList = { | 128 embedder.test.testList = { |
129 'testAppViewBasic': testAppViewBasic, | 129 'testAppViewWithUndefinedDataShouldSucceed': |
| 130 testAppViewWithUndefinedDataShouldSucceed, |
130 'testAppViewRefusedDataShouldFail': testAppViewRefusedDataShouldFail, | 131 'testAppViewRefusedDataShouldFail': testAppViewRefusedDataShouldFail, |
131 'testAppViewGoodDataShouldSucceed': testAppViewGoodDataShouldSucceed | 132 'testAppViewGoodDataShouldSucceed': testAppViewGoodDataShouldSucceed |
132 }; | 133 }; |
133 | 134 |
134 onload = function() { | 135 onload = function() { |
135 chrome.test.getConfig(function(config) { | 136 chrome.test.getConfig(function(config) { |
136 embedder.setUp_(config); | 137 embedder.setUp_(config); |
137 chrome.test.sendMessage('Launched'); | 138 chrome.test.sendMessage('Launched'); |
138 }); | 139 }); |
139 }; | 140 }; |
OLD | NEW |