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