Chromium Code Reviews| Index: chrome/test/data/extensions/platform_apps/app_icon/test.js |
| diff --git a/chrome/test/data/extensions/platform_apps/app_icon/test.js b/chrome/test/data/extensions/platform_apps/app_icon/test.js |
| index 3b3887a44de97bd77798c27b9a0e74fd15b31709..88a4210722e729f36abfba16e546300be5cd4654 100644 |
| --- a/chrome/test/data/extensions/platform_apps/app_icon/test.js |
| +++ b/chrome/test/data/extensions/platform_apps/app_icon/test.js |
| @@ -2,29 +2,54 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -chrome.app.runtime.onLaunched.addListener(function() { |
| - chrome.test.sendMessage("Launched"); |
| - // Create a panel window first |
| - chrome.app.window.create( |
| - 'main.html', { type: "panel" }, |
| - function (win) { |
| - // Set the panel window icon |
| - win.setIcon("icon64.png") |
| +var panelWindow; |
| +var nonShelfWindow; |
| +var shelfWindow; |
| + |
| +function processNextCommand() { |
| + chrome.test.sendMessage("ready", function(response) { |
| + if (response == 'Exit') { |
| + return; |
| + } |
| + if (response == 'createPanelWindow') { |
| + chrome.app.window.create('main.html', { type: "panel" }, function (win) { |
| + panelWindow = win; |
| + }); |
| + } |
| + if (response == 'setPanelWindowIcon') { |
| + panelWindow.setIcon("icon64.png") |
| + } |
| + if (response == 'createNonShelfWindow') { |
| // Create the shell window; it should use the app icon, and not affect |
| // the panel icon. |
| chrome.app.window.create( |
| - 'main.html', { type: "shell" }, |
| + 'main.html', { id: "win", |
| + type: "shell" }, |
| + function (win) { |
| + nonShelfWindow = win; |
|
Devlin
2017/05/31 22:00:01
two-space indentation in functions
khmel
2017/06/01 16:56:52
Done.
|
| + }); |
| + } |
| + if (response == 'createShelfWindow') { |
| + // Create the shell window which is shown in shelf; it should use |
| + // another custom app icon. |
| + chrome.app.window.create( |
| + 'main.html', { id: "win_with_icon", |
| + type: "shell", |
| + showInShelf: true }, |
| function (win) { |
| - // Create the shell window which is shown in shelf; it should use |
| - // another custom app icon. |
| - chrome.app.window.create( |
| - 'main.html', { id: "win_with_icon", |
| - type: "shell", |
| - icon: "icon48.png", |
| - showInShelf: true }, |
| - function (win) { |
| - chrome.test.sendMessage("Completed"); |
| - }); |
| + shelfWindow = win; |
| }); |
| - }); |
| + } |
| + if (response == 'setShelfWindowIcon') { |
| + shelfWindow.setIcon("icon32.png") |
|
Devlin
2017/05/31 22:00:01
single-quotes in js
khmel
2017/06/01 16:56:52
Done.
|
| + } |
| + processNextCommand(); |
| + }); |
| +}; |
| + |
| + |
| +chrome.app.runtime.onLaunched.addListener(function() { |
| + chrome.test.sendMessage("Launched"); |
| + processNextCommand(); |
| }); |
| + |