| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 window.onload = function() { | 5 window.onload = function() { |
| 6 chrome.management.getAll(function(items) { | 6 chrome.management.getAll(function(items) { |
| 7 for (var i in items) { | 7 for (var i in items) { |
| 8 var item = items[i]; | 8 var item = items[i]; |
| 9 if (item.name == "packaged_app") { | 9 if (item.name == "packaged_app") { |
| 10 chrome.management.launchApp(item.id); | 10 chrome.management.launchApp(item.id); |
| 11 break; | |
| 12 } | 11 } |
| 13 if (item.name == "simple_extension") { | 12 if (item.name == "simple_extension") { |
| 14 // Try launching a non-app extension, which should fail. | 13 // Try launching a non-app extension, which should fail. |
| 15 var expected_error = "Extension " + item.id + " is not an App"; | 14 var expected_error = "Extension " + item.id + " is not an App"; |
| 16 chrome.management.launchApp(item.id, function() { | 15 chrome.management.launchApp(item.id, function() { |
| 17 if (chrome.extension.lastError && | 16 if (chrome.extension.lastError && |
| 18 chrome.extension.lastError.message == expected_error) { | 17 chrome.extension.lastError.message == expected_error) { |
| 19 chrome.test.sendMessage("got_expected_error"); | 18 chrome.test.sendMessage("got_expected_error"); |
| 20 } | 19 } |
| 21 }); | 20 }); |
| 22 } | 21 } |
| 23 } | 22 } |
| 24 }); | 23 }); |
| 25 }; | 24 }; |
| 26 | 25 |
| OLD | NEW |