// Copyright (c) 2010 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.

window.onload = function() {
  chrome.management.getAll(function(items) {
    for (var i in items) {
      var item = items[i];
      if (item.name == "packaged_app") {
        chrome.management.launchApp(item.id);
        break;
      }
      if (item.name == "simple_extension") {
        // Try launching a non-app extension, which should fail.
        var expected_error = "Extension " + item.id + " is not an App";
        chrome.management.launchApp(item.id, function() {
          if (chrome.extension.lastError &&
              chrome.extension.lastError.message == expected_error) {
            chrome.test.sendMessage("got_expected_error");
          }
        });
      }
    }
  });
};


// Copyright (c) 2011 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.

window.onload = function() {
  chrome.management.getAll(function(items) {
    for (var i in items) {
      var item = items[i];
      if (item.name == "packaged_app") {
        chrome.management.launchApp(item.id);
      }
      if (item.name == "simple_extension") {
        // Try launching a non-app extension, which should fail.
        var expected_error = "Extension " + item.id + " is not an App";
        chrome.management.launchApp(item.id, function() {
          if (chrome.extension.lastError &&
              chrome.extension.lastError.message == expected_error) {
            chrome.test.sendMessage("got_expected_error");
          }
        });
      }
    }
  });
};


Fix ExtensionManagementApiBrowserTest.LaunchApp to no longer be order-dependent.
Fix ExtensionManagementApiBrowserTest.LaunchApp to no longer be order-dependent.

With the break, it fails if the app happens to come before the extension in items.

BUG=104091
TEST=none
TBR=asargent@chromium.org

Review URL: http://codereview.chromium.org/8801037

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@113141 0039d316-1c4b-4281-b951-d872f2087c98
