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

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: Rebase Created 6 years, 4 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('done');
19 break;
20
21 case 'guestCanAccessStorage':
22 // To test access to privileged APIs, the guest attempts to write to local
23 // storage. The guest relays the callbacks for storage.onChanged and
24 // storage.set to the test runner for verification.
25 chrome.storage.onChanged.addListener(function(change) {
26 chrome.runtime.sendMessage({
27 expected: 42,
28 actual: change.test.newValue,
29 description: 'onStorageChanged'
30 });
31 });
32
33 chrome.storage.local.set({'test': 42}, function() {
34 chrome.storage.local.get('test', function(storage) {
35 chrome.runtime.sendMessage({
36 expected: 42,
37 actual: storage.test,
38 description: 'onSetAndGet'
39 });
40 });
41 });
42 }
43 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698