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

Side by Side Diff: chrome/test/data/extensions/api_test/management/test/launchType.js

Issue 937843004: Disable bookmark apps on non-ChromeOS platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wow - how did that compile anywhere Created 5 years, 10 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
« no previous file with comments | « chrome/renderer/web_apps.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 var enabled_app, disabled_app, enabled_extension, packaged_app; 5 var enabled_app, disabled_app, enabled_extension, packaged_app;
6 var allLaunchTypes = ["OPEN_AS_REGULAR_TAB", 6 var allLaunchTypes = ["OPEN_AS_REGULAR_TAB",
7 "OPEN_AS_PINNED_TAB", 7 "OPEN_AS_PINNED_TAB",
8 "OPEN_AS_WINDOW", 8 "OPEN_AS_WINDOW",
9 "OPEN_FULL_SCREEN"]; 9 "OPEN_FULL_SCREEN"];
10 10
(...skipping 14 matching lines...) Expand all
25 function getAvailableLaunchTypes(app) { 25 function getAvailableLaunchTypes(app) {
26 var types = Array(); 26 var types = Array();
27 if (app.type == "packaged_app") { 27 if (app.type == "packaged_app") {
28 types.push("OPEN_AS_WINDOW"); 28 types.push("OPEN_AS_WINDOW");
29 return types; 29 return types;
30 } 30 }
31 31
32 types.push("OPEN_AS_REGULAR_TAB"); 32 types.push("OPEN_AS_REGULAR_TAB");
33 types.push("OPEN_AS_WINDOW"); 33 types.push("OPEN_AS_WINDOW");
34 34
35 if (navigator.userAgent.indexOf("CrOS") == -1) {
36 types.push("OPEN_AS_PINNED_TAB");
37 types.push("OPEN_FULL_SCREEN");
38 }
39
35 return types; 40 return types;
36 } 41 }
37 42
38 function verifyAvailableLaunchTypes(expected, actual) { 43 function verifyAvailableLaunchTypes(expected, actual) {
39 assertEq(expected.length, actual.length); 44 assertEq(expected.length, actual.length);
40 for (var i = 0; i < expected.length; i++) 45 for (var i = 0; i < expected.length; i++)
41 assertTrue(actual.indexOf(expected[i]) != -1); 46 assertTrue(actual.indexOf(expected[i]) != -1);
42 } 47 }
43 48
44 function testSetAllLaunchTypes(app) { 49 function testSetAllLaunchTypes(app) {
45 var availableTypes = getAvailableLaunchTypes(app); 50 var availableTypes = getAvailableLaunchTypes(app);
46 51
47 var setLaunchType = function(i) { 52 var setLaunchType = function(i) {
48 var setNextLaunchType = function() { 53 var setNextLaunchType = function() {
49 if (i + 1 < allLaunchTypes.length) 54 if (i + 1 < allLaunchTypes.length)
50 setLaunchType(i + 1); 55 setLaunchType(i + 1);
51 }; 56 };
52 57
53 var type = allLaunchTypes[i]; 58 var type = allLaunchTypes[i];
54 if (availableTypes.indexOf(type) < 0) { 59 if (availableTypes.indexOf(type) < 0) {
55 testSetLaunchType(app.id, 60 testSetLaunchType(app.id,
56 type, 61 type,
57 "The launch type is not available for this app.", 62 "The launch type is not available for this app.",
58 setNextLaunchType); 63 setNextLaunchType);
59 } else { 64 } else {
60 testSetLaunchType(app.id, type, null, function() { 65 testSetLaunchType(app.id, type, null, function() {
61 chrome.management.get(app.id, function(item) { 66 chrome.management.get(app.id, function(item) {
67 if (navigator.userAgent.indexOf("Mac") != -1) {
68 // In the current configuration, with the new bookmark app flow
69 // disabled, hosted apps set to open in a window on Mac will open
70 // instead in a tab.
71 if (item.type != 'packaged_app' && type == 'OPEN_AS_WINDOW')
72 type = 'OPEN_AS_REGULAR_TAB';
73 }
62 assertEq(type, item.launchType); 74 assertEq(type, item.launchType);
63 setNextLaunchType(); 75 setNextLaunchType();
64 }); 76 });
65 }); 77 });
66 } 78 }
67 }; 79 };
68 80
69 if (allLaunchTypes.length > 0) 81 if (allLaunchTypes.length > 0)
70 setLaunchType(0); 82 setLaunchType(0);
71 } 83 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 ]; 140 ];
129 141
130 chrome.management.getAll(callback(function(items) { 142 chrome.management.getAll(callback(function(items) {
131 enabled_app = getItemNamed(items, "enabled_app"); 143 enabled_app = getItemNamed(items, "enabled_app");
132 disabled_app = getItemNamed(items, "disabled_app"); 144 disabled_app = getItemNamed(items, "disabled_app");
133 enabled_extension = getItemNamed(items, "enabled_extension"); 145 enabled_extension = getItemNamed(items, "enabled_extension");
134 packaged_app = getItemNamed(items, "packaged_app"); 146 packaged_app = getItemNamed(items, "packaged_app");
135 147
136 chrome.test.runTests(tests); 148 chrome.test.runTests(tests);
137 })); 149 }));
OLDNEW
« no previous file with comments | « chrome/renderer/web_apps.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698