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

Side by Side Diff: chrome/test/data/extensions/api_test/extension_options/embed_self/options.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 // This script is opened inside a <extensionoptions> guest view. When opened,
6 // it sends a message back to the test page, which responds with which test case
7 // it is running. The options page then runs the appropriate code for the
8 // specified test case.
9 chrome.runtime.sendMessage('ready', function(command) {
10 switch(command) {
11 case 'canCreateExtensionOptionsGuest':
12 // To confirm that the guest view has been successfully created,
13 // {pass: true} is added to every extension Window and broadcasts a
14 // message to the extension using runtime.sendMessage().
15 chrome.extension.getViews().forEach(function(view) {
16 view.pass = true;
17 });
18 chrome.runtime.sendMessage('hi');
not at google - send to devlin 2014/07/19 01:37:09 break;
ericzeng 2014/07/19 03:44:25 Done.
19 case 'guestCanAccessStorage':
20 // To test access to privileged APIs, the guest attempts to write to local
21 // storage, and both the embedder and guest check if the write succeeded.
22 var passed = chrome.test.callbackPass;
23
24 chrome.test.listenOnce(chrome.storage.onChanged, function(change) {
25 chrome.test.assertEq(42, change.test.newValue);
26 });
27
28 chrome.storage.local.set({'test': 42}, passed(function() {
29 chrome.storage.local.get('test', passed(function(storage) {
30 chrome.test.assertEq(42, storage.test);
31 }));
32 }));
33 }
34 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698