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

Side by Side Diff: chrome/test/data/extensions/platform_apps/disabled_window_properties/test.js

Issue 120733003: Feature detection-friendly restrictions for packaged apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback. Created 6 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // NOTE: Some of the test code was put in the global scope on purpose! 5 // NOTE: Some of the test code was put in the global scope on purpose!
6 6
7 function useToolbarGetter() { 7 var resultFromToolbarGetterAtStart = window.toolbar;
8 var result;
9 try {
10 // The following will invoke the window.toolbar getter, and this may or may
11 // not throw an exception.
12 result = {object: window.toolbar};
13 } catch (e) {
14 result = {exception: e};
15 }
16 return result;
17 }
18
19 var resultFromToolbarGetterAtStart = useToolbarGetter();
20 8
21 // The following statement implicitly invokes the window.toolbar setter. This 9 // The following statement implicitly invokes the window.toolbar setter. This
22 // should delete the "disabler" getter and setter that were set up in 10 // should delete the "disabler" getter and setter that were set up in
23 // chrome/renderer/resources/extensions/platform_app.js, and restore normal 11 // chrome/renderer/resources/extensions/platform_app.js, and restore normal
24 // getter/setter behaviors from here on. 12 // getter/setter behaviors from here on.
25 var toolbar = {blah: 'glarf'}; 13 var toolbar = {blah: 'glarf'};
26 14
27 var resultFromToolbarGetterAfterRedefinition = useToolbarGetter(); 15 var resultFromToolbarGetterAfterRedefinition = window.toolbar;
28 var toolbarIsWindowToolbarAfterRedefinition = (toolbar === window.toolbar); 16 var toolbarIsWindowToolbarAfterRedefinition = (toolbar === window.toolbar);
29 17
30 toolbar.blah = 'baz'; 18 toolbar.blah = 'baz';
31 19
32 chrome.app.runtime.onLaunched.addListener(function() { 20 chrome.app.runtime.onLaunched.addListener(function() {
33 chrome.test.assertTrue( 21 chrome.test.assertEq('undefined', typeof(resultFromToolbarGetterAtStart));
34 resultFromToolbarGetterAtStart.hasOwnProperty('exception')); 22 chrome.test.assertEq('object',
35 23 typeof(resultFromToolbarGetterAfterRedefinition));
36 chrome.test.assertTrue(
37 resultFromToolbarGetterAfterRedefinition.hasOwnProperty('object'));
38 chrome.test.assertTrue(toolbarIsWindowToolbarAfterRedefinition); 24 chrome.test.assertTrue(toolbarIsWindowToolbarAfterRedefinition);
39 25
40 chrome.test.assertEq('baz', toolbar.blah); 26 chrome.test.assertEq('baz', toolbar.blah);
41 27
42 chrome.test.notifyPass(); 28 chrome.test.notifyPass();
43 }); 29 });
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/platform_app.js ('k') | chrome/test/data/extensions/platform_apps/restrictions/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698