Index: chrome/test/data/extensions/api_test/extension_options/embed_self/options.js |
diff --git a/chrome/test/data/extensions/api_test/extension_options/embed_self/options.js b/chrome/test/data/extensions/api_test/extension_options/embed_self/options.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04ecdfe55da8eba217bf2feaa48f71154acf5550 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/extension_options/embed_self/options.js |
@@ -0,0 +1,34 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// This script is opened inside a <extensionoptions> guest view. When opened, |
+// it sends a message back to the test page, which responds with which test case |
+// it is running. The options page then runs the appropriate code for the |
+// specified test case. |
+chrome.runtime.sendMessage('ready', function(command) { |
+ switch(command) { |
+ case 'canCreateExtensionOptionsGuest': |
+ // To confirm that the guest view has been successfully created, |
+ // {pass: true} is added to every extension Window and broadcasts a |
+ // message to the extension using runtime.sendMessage(). |
+ chrome.extension.getViews().forEach(function(view) { |
+ view.pass = true; |
+ }); |
+ 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.
|
+ case 'guestCanAccessStorage': |
+ // To test access to privileged APIs, the guest attempts to write to local |
+ // storage, and both the embedder and guest check if the write succeeded. |
+ var passed = chrome.test.callbackPass; |
+ |
+ chrome.test.listenOnce(chrome.storage.onChanged, function(change) { |
+ chrome.test.assertEq(42, change.test.newValue); |
+ }); |
+ |
+ chrome.storage.local.set({'test': 42}, passed(function() { |
+ chrome.storage.local.get('test', passed(function(storage) { |
+ chrome.test.assertEq(42, storage.test); |
+ })); |
+ })); |
+ } |
+}); |