| 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/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 | 6 |
| 7 #include "chrome/browser/notifications/desktop_notification_service.h" | 7 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/extensions/extension_process_manager.h" | 11 #include "chrome/browser/extensions/extension_process_manager.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/common/chrome_switches.h" | |
| 14 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "extensions/common/switches.h" |
| 15 #include "ui/message_center/message_center_switches.h" | 15 #include "ui/message_center/message_center_switches.h" |
| 16 #include "ui/message_center/message_center_util.h" | 16 #include "ui/message_center/message_center_util.h" |
| 17 | 17 |
| 18 class NotificationIdleTest : public ExtensionApiTest { | 18 class NotificationIdleTest : public ExtensionApiTest { |
| 19 protected: | 19 protected: |
| 20 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 20 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 21 ExtensionApiTest::SetUpCommandLine(command_line); | 21 ExtensionApiTest::SetUpCommandLine(command_line); |
| 22 | 22 |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 IN_PROC_BROWSER_TEST_F(NotificationIdleTest, MAYBE_NotificationsAllowUnload) { | 74 IN_PROC_BROWSER_TEST_F(NotificationIdleTest, MAYBE_NotificationsAllowUnload) { |
| 73 const extensions::Extension* extension = | 75 const extensions::Extension* extension = |
| 74 LoadExtensionAndWait("notifications/api/unload"); | 76 LoadExtensionAndWait("notifications/api/unload"); |
| 75 ASSERT_TRUE(extension) << message_; | 77 ASSERT_TRUE(extension) << message_; |
| 76 | 78 |
| 77 // Lazy Background Page has been shut down. | 79 // Lazy Background Page has been shut down. |
| 78 ExtensionProcessManager* pm = | 80 ExtensionProcessManager* pm = |
| 79 extensions::ExtensionSystem::Get(profile())->process_manager(); | 81 extensions::ExtensionSystem::Get(profile())->process_manager(); |
| 80 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); | 82 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); |
| 81 } | 83 } |
| OLD | NEW |