1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 embedder
.setUp_ = function(config
) {
8 if (!config
|| !config
.testServer
) {
11 embedder
.baseGuestURL
= 'http://localhost:' + config
.testServer
.port
;
12 embedder
.emptyGuestURL
= embedder
.baseGuestURL
+
13 '/extensions/platform_apps/web_view/shim/empty_guest.html';
16 window
.runTest = function(testName
, appToEmbed
) {
17 if (!embedder
.test
.testList
[testName
]) {
18 window
.console
.log('Incorrect testName: ' + testName
);
24 embedder
.test
.testList
[testName
](appToEmbed
);
27 var LOG = function(msg
) {
28 window
.console
.log(msg
);
32 embedder
.test
.succeed = function() {
33 chrome
.test
.sendMessage('TEST_PASSED');
36 embedder
.test
.fail = function() {
37 chrome
.test
.sendMessage('TEST_FAILED');
40 embedder
.test
.assertTrue = function(condition
) {
42 console
.log('Assertion failed: true != ' + condition
);
47 embedder
.test
.assertFalse = function(condition
) {
49 console
.log('Assertion failed: false != ' + condition
);
55 function testExtensionViewCreationShouldSucceed(appToEmbed
) {
56 LOG('Checking that there are no instances of <extensionview>.');
57 embedder
.test
.assertFalse(document
.querySelector('extensionview'));
58 var extensionview
= new ExtensionView();
60 LOG('Appending new <extensionview> to DOM.');
61 document
.body
.appendChild(extensionview
);
63 LOG('Checking that <extensionview> exists.');
64 if (document
.querySelector('extensionview')) {
65 embedder
.test
.succeed();
71 embedder
.test
.testList
= {
72 'testExtensionViewCreationShouldSucceed':
73 testExtensionViewCreationShouldSucceed
77 chrome
.test
.getConfig(function(config
) {
78 embedder
.setUp_(config
);
79 chrome
.test
.sendMessage('Launched');