OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r.h" | 5 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r.h" |
6 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r_factory.h" | 6 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r_factory.h" |
7 #include "chrome/browser/extensions/extension_action.h" | 7 #include "chrome/browser/extensions/extension_action.h" |
8 #include "chrome/browser/extensions/extension_action_manager.h" | 8 #include "chrome/browser/extensions/extension_action_manager.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/lazy_background_page_test_util.h" | 10 #include "chrome/browser/extensions/lazy_background_page_test_util.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "extensions/browser/extension_system.h" | 12 #include "extensions/browser/extension_system.h" |
13 #include "extensions/browser/process_manager.h" | 13 #include "extensions/browser/process_manager.h" |
14 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
15 #include "extensions/common/switches.h" | 15 #include "extensions/common/switches.h" |
| 16 #include "extensions/test/result_catcher.h" |
16 | 17 |
17 class SystemIndicatorApiTest : public ExtensionApiTest { | 18 class SystemIndicatorApiTest : public ExtensionApiTest { |
18 public: | 19 public: |
19 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 20 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
20 ExtensionApiTest::SetUpCommandLine(command_line); | 21 ExtensionApiTest::SetUpCommandLine(command_line); |
21 // Set shorter delays to prevent test timeouts in tests that need to wait | 22 // Set shorter delays to prevent test timeouts in tests that need to wait |
22 // for the event page to unload. | 23 // for the event page to unload. |
23 command_line->AppendSwitchASCII( | 24 command_line->AppendSwitchASCII( |
24 extensions::switches::kEventPageIdleTime, "1000"); | 25 extensions::switches::kEventPageIdleTime, "1000"); |
25 command_line->AppendSwitchASCII( | 26 command_line->AppendSwitchASCII( |
(...skipping 20 matching lines...) Expand all Loading... |
46 ASSERT_TRUE(RunExtensionTest("system_indicator/basics")) << message_; | 47 ASSERT_TRUE(RunExtensionTest("system_indicator/basics")) << message_; |
47 } | 48 } |
48 } | 49 } |
49 | 50 |
50 IN_PROC_BROWSER_TEST_F(SystemIndicatorApiTest, SystemIndicator) { | 51 IN_PROC_BROWSER_TEST_F(SystemIndicatorApiTest, SystemIndicator) { |
51 // Only run this test on supported platforms. SystemIndicatorManagerFactory | 52 // Only run this test on supported platforms. SystemIndicatorManagerFactory |
52 // returns NULL on unsupported platforms. | 53 // returns NULL on unsupported platforms. |
53 extensions::SystemIndicatorManager* manager = | 54 extensions::SystemIndicatorManager* manager = |
54 extensions::SystemIndicatorManagerFactory::GetForProfile(profile()); | 55 extensions::SystemIndicatorManagerFactory::GetForProfile(profile()); |
55 if (manager) { | 56 if (manager) { |
56 ResultCatcher catcher; | 57 extensions::ResultCatcher catcher; |
57 | 58 |
58 const extensions::Extension* extension = | 59 const extensions::Extension* extension = |
59 LoadExtensionAndWait("system_indicator/unloaded"); | 60 LoadExtensionAndWait("system_indicator/unloaded"); |
60 ASSERT_TRUE(extension) << message_; | 61 ASSERT_TRUE(extension) << message_; |
61 | 62 |
62 // Lazy Background Page has been shut down. | 63 // Lazy Background Page has been shut down. |
63 extensions::ProcessManager* pm = | 64 extensions::ProcessManager* pm = |
64 extensions::ExtensionSystem::Get(profile())->process_manager(); | 65 extensions::ExtensionSystem::Get(profile())->process_manager(); |
65 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); | 66 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); |
66 | 67 |
67 EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id())); | 68 EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id())); |
68 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 69 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
69 } | 70 } |
70 } | 71 } |
OLD | NEW |