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" | |
16 | 15 |
17 class SystemIndicatorApiTest : public ExtensionApiTest { | 16 class SystemIndicatorApiTest : public ExtensionApiTest { |
18 public: | 17 public: |
19 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 18 virtual void SetUpOnMainThread() OVERRIDE { |
20 ExtensionApiTest::SetUpCommandLine(command_line); | 19 ExtensionApiTest::SetUpOnMainThread(); |
21 // Set shorter delays to prevent test timeouts in tests that need to wait | 20 // Set shorter delays to prevent test timeouts in tests that need to wait |
22 // for the event page to unload. | 21 // for the event page to unload. |
23 command_line->AppendSwitchASCII( | 22 extensions::ProcessManager::SetEventPageIdleTimeForTesting(1); |
24 extensions::switches::kEventPageIdleTime, "1000"); | 23 extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(1); |
25 command_line->AppendSwitchASCII( | |
26 extensions::switches::kEventPageSuspendingTime, "1000"); | |
27 } | 24 } |
28 | 25 |
29 const extensions::Extension* LoadExtensionAndWait( | 26 const extensions::Extension* LoadExtensionAndWait( |
30 const std::string& test_name) { | 27 const std::string& test_name) { |
31 LazyBackgroundObserver page_complete; | 28 LazyBackgroundObserver page_complete; |
32 base::FilePath extdir = test_data_dir_.AppendASCII(test_name); | 29 base::FilePath extdir = test_data_dir_.AppendASCII(test_name); |
33 const extensions::Extension* extension = LoadExtension(extdir); | 30 const extensions::Extension* extension = LoadExtension(extdir); |
34 if (extension) | 31 if (extension) |
35 page_complete.Wait(); | 32 page_complete.Wait(); |
36 return extension; | 33 return extension; |
(...skipping 24 matching lines...) Expand all Loading... |
61 | 58 |
62 // Lazy Background Page has been shut down. | 59 // Lazy Background Page has been shut down. |
63 extensions::ProcessManager* pm = | 60 extensions::ProcessManager* pm = |
64 extensions::ExtensionSystem::Get(profile())->process_manager(); | 61 extensions::ExtensionSystem::Get(profile())->process_manager(); |
65 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); | 62 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); |
66 | 63 |
67 EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id())); | 64 EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id())); |
68 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 65 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
69 } | 66 } |
70 } | 67 } |
OLD | NEW |