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

Side by Side Diff: chrome/test/data/extensions/api_test/extension_options/embed_self/test.js

Issue 378783002: Initial implementation of the <extensionoptions> GuestView tag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve test structure Created 6 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
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 chrome.test.runTests([
6 // Tests if the <extensionoptions> guest view is successfully created. This
7 // test expects that the guest options page will add a {'pass': true} property
8 // to every Window and fire the runtime.onMessage event with a short message.
9 function canCreateExtensionOptionsGuest() {
10 chrome.test.listenForever(chrome.runtime.onMessage,
11 function(message, sender, sendResponse) {
12 if (message == 'ready') {
13 sendResponse('canCreateExtensionOptionsGuest');
14 } else if (message == 'hi') {
15 var views = chrome.extension.getViews();
16 chrome.test.assertEq(2, views.length);
17 views.forEach(function(view) {
18 chrome.test.assertTrue(view.pass);
19 });
20 chrome.test.assertEq(chrome.runtime.id, sender.id);
21 chrome.test.succeed();
22
23 document.body.removeChild(document.querySelector('extensionoptions'));
not at google - send to devlin 2014/07/19 01:37:09 document.body.removeChild(extensionoptions);
ericzeng 2014/07/19 03:44:25 Done.
24 }
25 });
26
27 var extensionoptions = document.createElement('extensionoptions');
28 extensionoptions.setAttribute('extension', chrome.runtime.id);
29 document.body.appendChild(extensionoptions);
30 },
31
32 // Tests if the <extensionoptions> guest view can access the chrome.storage
33 // API, a privileged extension API.
34 function guestCanAccessStorage() {
35 chrome.test.listenOnce(chrome.storage.onChanged, function(change) {
36 chrome.test.assertEq(42, change.test.newValue);
37 chrome.test.succeed();
38 document.body.removeChild(document.querySelector('extensionoptions'));
39 });
40
41 chrome.test.listenOnce(chrome.runtime.onMessage,
42 function(message, sender, sendResponse){
43 sendResponse('guestCanAccessStorage');
44 })
45
46 var extensionoptions = document.createElement('extensionoptions');
47 extensionoptions.setAttribute('extension', chrome.runtime.id);
48 document.body.appendChild(extensionoptions);
49 }
50 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698