Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: extensions/test/data/app_view/apitest/main.js

Issue 643703007: Adding app_view tests to app_shell_browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multiple_apps
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 70%
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..bbff36b66442c2bbcb279393874761ece88f64e4 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]) {
@@ -48,52 +31,41 @@ embedder.test.fail = function() {
embedder.test.assertEq = function(a, b) {
if (a != b) {
- console.log('assertion failed: ' + a + ' != ' + b);
+ console.log('Assertion failed: ' + a + ' != ' + b);
embedder.test.fail();
}
};
embedder.test.assertTrue = function(condition) {
if (!condition) {
- console.log('assertion failed: true != ' + condition);
+ console.log('Assertion failed: true != ' + condition);
embedder.test.fail();
}
};
embedder.test.assertFalse = function(condition) {
if (condition) {
- console.log('assertion failed: false != ' + condition);
+ console.log('Assertion failed: false != ' + condition);
embedder.test.fail();
}
};
// 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) {
+ // 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();
});
};
@@ -102,46 +74,54 @@ function testAppViewRefusedDataShouldFail(appToEmbed) {
LOG('appToEmbed ' + appToEmbed);
document.body.appendChild(appview);
LOG('Attempting to connect to app with refused params.');
- appview.connect(appToEmbed, { 'foo': 'bar' }, function(success) {
+ appview.connect(appToEmbed, {'foo': 'bar'}, function(success) {
// Make sure we fail.
if (success) {
LOG('UNEXPECTED CONNECTION.');
embedder.test.fail();
return;
}
- LOG('FAILED TO CONNECT.');
+ LOG('Failed to connect.');
embedder.test.succeed();
});
};
-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 (abc123).
+ LOG('Attempting to connect to non-existant app.');
+ 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.');
+ 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');
};

Powered by Google App Engine
This is Rietveld 408576698