Home | History | Annotate | Download | only in extensions
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/extensions/extension_browsertest.h"
      6 #include "chrome/browser/extensions/extension_test_message_listener.h"
      7 
      8 class ExtensionManagementApiBrowserTest : public ExtensionBrowserTest {};
      9 
     10 // We test this here instead of in an ExtensionApiTest because normal extensions
     11 // are not allowed to call the install function.
     12 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, InstallEvent) {
     13   ExtensionTestMessageListener listener1("ready", false);
     14   ASSERT_TRUE(LoadExtension(
     15       test_data_dir_.AppendASCII("management/install_event")));
     16   ASSERT_TRUE(listener1.WaitUntilSatisfied());
     17 
     18   ExtensionTestMessageListener listener2("got_event", false);
     19   ASSERT_TRUE(LoadExtension(
     20       test_data_dir_.AppendASCII("api_test/management/enabled_extension")));
     21   ASSERT_TRUE(listener2.WaitUntilSatisfied());
     22 }
     23 
     24 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, LaunchApp) {
     25   ExtensionTestMessageListener listener1("app_launched", false);
     26   ExtensionTestMessageListener listener2("got_expected_error", false);
     27   ASSERT_TRUE(LoadExtension(
     28       test_data_dir_.AppendASCII("management/simple_extension")));
     29   ASSERT_TRUE(LoadExtension(
     30       test_data_dir_.AppendASCII("management/packaged_app")));
     31   ASSERT_TRUE(LoadExtension(
     32       test_data_dir_.AppendASCII("management/launch_app")));
     33   ASSERT_TRUE(listener1.WaitUntilSatisfied());
     34   ASSERT_TRUE(listener2.WaitUntilSatisfied());
     35 }
     36 
     37 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest,
     38                        LaunchAppFromBackground) {
     39   ExtensionTestMessageListener listener1("success", false);
     40   ASSERT_TRUE(LoadExtension(
     41       test_data_dir_.AppendASCII("management/packaged_app")));
     42   ASSERT_TRUE(LoadExtension(
     43       test_data_dir_.AppendASCII("management/launch_app_from_background")));
     44   ASSERT_TRUE(listener1.WaitUntilSatisfied());
     45 }
     46