Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / extension_options / embed_invalid / test.js
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
3 // found in the LICENSE file.
4
5 function testCannotEmbedExtension(id) {
6   var done = chrome.test.callbackAdded();
7   var extensionoptions = document.createElement('extensionoptions');
8   extensionoptions.addEventListener('createfailed', function() {
9     document.body.removeChild(extensionoptions);
10     done();
11   });
12   extensionoptions.addEventListener('load', function () {
13     document.body.removeChild(extensionoptions);
14     chrome.test.fail();
15   });
16   extensionoptions.setAttribute('extension', id);
17   document.body.appendChild(extensionoptions);
18 }
19
20 chrome.test.runTests([
21   function cannotEmbedInvalidExtensionId() {
22     testCannotEmbedExtension('thisisprobablynotrealextensionid');
23   },
24
25   function cannotEmbedSelfIfNoOptionsPage() {
26     testCannotEmbedExtension(chrome.runtime.id);
27   }
28 ]);