Chromium Code Reviews| Index: extensions/test/data/app_view/apitest/main.js |
| diff --git a/chrome/test/data/extensions/platform_apps/app_view/shim/main.js b/extensions/test/data/app_view/apitest/main.js |
| similarity index 82% |
| copy from chrome/test/data/extensions/platform_apps/app_view/shim/main.js |
| copy to extensions/test/data/app_view/apitest/main.js |
| index fe3c2eb164b2fa95a4554af477bb756a1690115a..3ba7e47fdf0aac0140f03654582f0513cf6c42c8 100644 |
| --- a/chrome/test/data/extensions/platform_apps/app_view/shim/main.js |
| +++ b/extensions/test/data/app_view/apitest/main.js |
| @@ -4,23 +4,6 @@ |
| var util = {}; |
| var embedder = {}; |
| -embedder.baseGuestURL = ''; |
| -embedder.emptyGuestURL = ''; |
| -embedder.windowOpenGuestURL = ''; |
| -embedder.noReferrerGuestURL = ''; |
| -embedder.redirectGuestURL = ''; |
| -embedder.redirectGuestURLDest = ''; |
| -embedder.closeSocketURL = ''; |
| -embedder.tests = {}; |
| - |
| -embedder.setUp_ = function(config) { |
| - if (!config || !config.testServer) { |
| - return; |
| - } |
| - embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; |
| - embedder.emptyGuestURL = embedder.baseGuestURL + |
| - '/extensions/platform_apps/web_view/shim/empty_guest.html'; |
| -}; |
| window.runTest = function(testName, appToEmbed) { |
| if (!embedder.test.testList[testName]) { |
| @@ -68,32 +51,21 @@ embedder.test.assertFalse = function(condition) { |
| }; |
| // Tests begin. |
| -function testAppViewWithUndefinedDataShouldSucceed(appToEmbed) { |
| +function testAppViewGoodDataShouldSucceed(appToEmbed) { |
| var appview = new AppView(); |
| LOG('appToEmbed ' + appToEmbed); |
| document.body.appendChild(appview); |
| - // Step 1: Attempt to connect to a non-existant app. |
| - LOG('attempting to connect to non-existant app.'); |
| - appview.connect('abc123', undefined, function(success) { |
| - // Make sure we fail. |
| - if (success) { |
| - LOG('UNEXPECTED CONNECTION.'); |
| + LOG('Attempting to connect to app with good params.'); |
| + // Step 2: Attempt to connect to an app with good params. |
| + appview.connect(appToEmbed, { 'foo': 'bleep' }, function(success) { |
|
lazyboy
2014/10/24 20:13:25
Here and below: no space after { or before }
lfg
2014/10/24 20:24:30
Done.
|
| + // Make sure we don't fail. |
| + if (!success) { |
| + LOG('FAILED TO CONNECT.'); |
| embedder.test.fail(); |
| return; |
| } |
| - LOG('failed to connect to non-existant app.'); |
| - LOG('attempting to connect to known app.'); |
| - // Step 2: Attempt to connect to an app we know exists. |
| - appview.connect(appToEmbed, undefined, function(success) { |
| - // Make sure we don't fail. |
| - if (!success) { |
| - LOG('FAILED TO CONNECT.'); |
| - embedder.test.fail(); |
| - return; |
| - } |
| - LOG('CONNECTED.'); |
| - embedder.test.succeed(); |
| - }); |
| + LOG('CONNECTED.'); |
| + embedder.test.succeed(); |
| }); |
| }; |
| @@ -114,34 +86,42 @@ function testAppViewRefusedDataShouldFail(appToEmbed) { |
| }); |
| }; |
| -function testAppViewGoodDataShouldSucceed(appToEmbed) { |
| +function testAppViewWithUndefinedDataShouldSucceed(appToEmbed) { |
| var appview = new AppView(); |
| LOG('appToEmbed ' + appToEmbed); |
| document.body.appendChild(appview); |
| - LOG('Attempting to connect to app with good params.'); |
| - // Step 2: Attempt to connect to an app with good params. |
| - appview.connect(appToEmbed, { 'foo': 'bleep' }, function(success) { |
| - // Make sure we don't fail. |
| - if (!success) { |
| - LOG('FAILED TO CONNECT.'); |
| + // Step 1: Attempt to connect to a non-existant app. |
|
lazyboy
2014/10/24 20:13:25
s/non-existant/non-existent
Also add note that "ab
lfg
2014/10/24 20:24:29
Done.
|
| + LOG('attempting to connect to non-existant app.'); |
|
lazyboy
2014/10/24 20:13:25
nit: s/attempting/Attempting
lfg
2014/10/24 20:24:30
Done.
|
| + appview.connect('abc123', undefined, function(success) { |
| + // Make sure we fail. |
| + if (success) { |
| + LOG('UNEXPECTED CONNECTION.'); |
| embedder.test.fail(); |
| return; |
| } |
| - LOG('CONNECTED.'); |
| - embedder.test.succeed(); |
| + LOG('failed to connect to non-existant app.'); |
| + LOG('attempting to connect to known app.'); |
| + // Step 2: Attempt to connect to an app we know exists. |
| + appview.connect(appToEmbed, undefined, function(success) { |
| + // Make sure we don't fail. |
| + if (!success) { |
| + LOG('FAILED TO CONNECT.'); |
| + embedder.test.fail(); |
| + return; |
| + } |
| + LOG('CONNECTED.'); |
|
lazyboy
2014/10/24 20:13:25
nit: s/CONNECTED/Connected, SHOUT only when things
lfg
2014/10/24 20:24:30
Done.
|
| + embedder.test.succeed(); |
| + }); |
| }); |
| }; |
| embedder.test.testList = { |
| - 'testAppViewWithUndefinedDataShouldSucceed': |
| - testAppViewWithUndefinedDataShouldSucceed, |
| + 'testAppViewGoodDataShouldSucceed': testAppViewGoodDataShouldSucceed, |
| 'testAppViewRefusedDataShouldFail': testAppViewRefusedDataShouldFail, |
| - 'testAppViewGoodDataShouldSucceed': testAppViewGoodDataShouldSucceed |
| + 'testAppViewWithUndefinedDataShouldSucceed': |
| + testAppViewWithUndefinedDataShouldSucceed |
| }; |
| onload = function() { |
| - chrome.test.getConfig(function(config) { |
| - embedder.setUp_(config); |
| - chrome.test.sendMessage('Launched'); |
| - }); |
| + chrome.test.sendMessage('LAUNCHED'); |
| }; |