Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/extensions/app_background_page_apitest.cc

Issue 547003002: Remove the --event-page-idle-time and --event-page-suspending-time switches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: 1s Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/path_service.h" 5 #include "base/path_service.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/background/background_contents_service.h" 8 #include "chrome/browser/background/background_contents_service.h"
9 #include "chrome/browser/background/background_contents_service_factory.h" 9 #include "chrome/browser/background/background_contents_service_factory.h"
10 #include "chrome/browser/background/background_mode_manager.h" 10 #include "chrome/browser/background/background_mode_manager.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/extension_test_message_listener.h" 15 #include "chrome/browser/extensions/extension_test_message_listener.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_dialogs.h" 18 #include "chrome/browser/ui/browser_dialogs.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/extensions/application_launch.h" 20 #include "chrome/browser/ui/extensions/application_launch.h"
21 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "content/public/test/test_notification_tracker.h" 24 #include "content/public/test/test_notification_tracker.h"
25 #include "content/public/test/test_utils.h" 25 #include "content/public/test/test_utils.h"
26 #include "extensions/browser/process_manager.h"
26 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
27 #include "extensions/common/switches.h" 28 #include "extensions/common/switches.h"
28 #include "net/dns/mock_host_resolver.h" 29 #include "net/dns/mock_host_resolver.h"
29 #include "net/test/embedded_test_server/embedded_test_server.h" 30 #include "net/test/embedded_test_server/embedded_test_server.h"
30 31
31 #if !defined(DISABLE_NACL) 32 #if !defined(DISABLE_NACL)
32 #include "components/nacl/browser/nacl_process_host.h" 33 #include "components/nacl/browser/nacl_process_host.h"
33 #endif 34 #endif
34 35
35 #if defined(OS_MACOSX) 36 #if defined(OS_MACOSX)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 // Fixture to assist in testing v2 app background pages containing 123 // Fixture to assist in testing v2 app background pages containing
123 // Native Client embeds. 124 // Native Client embeds.
124 class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest { 125 class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest {
125 public: 126 public:
126 AppBackgroundPageNaClTest() 127 AppBackgroundPageNaClTest()
127 : extension_(NULL) {} 128 : extension_(NULL) {}
128 virtual ~AppBackgroundPageNaClTest() { 129 virtual ~AppBackgroundPageNaClTest() {
129 } 130 }
130 131
131 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 132 virtual void SetUpOnMainThread() OVERRIDE {
132 AppBackgroundPageApiTest::SetUpCommandLine(command_line); 133 AppBackgroundPageApiTest::SetUpOnMainThread();
133 #if !defined(DISABLE_NACL) 134 #if !defined(DISABLE_NACL)
134 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50); 135 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50);
135 #endif 136 #endif
136 command_line->AppendSwitchASCII( 137 extensions::ProcessManager::SetEventPageIdleTimeForTesting(1000);
137 extensions::switches::kEventPageIdleTime, "1000"); 138 extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(1000);
138 command_line->AppendSwitchASCII(
139 extensions::switches::kEventPageSuspendingTime, "1000");
140 } 139 }
141 140
142 const Extension* extension() { return extension_; } 141 const Extension* extension() { return extension_; }
143 142
144 protected: 143 protected:
145 void LaunchTestingApp() { 144 void LaunchTestingApp() {
146 base::FilePath app_dir; 145 base::FilePath app_dir;
147 PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir); 146 PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir);
148 app_dir = app_dir.AppendASCII( 147 app_dir = app_dir.AppendASCII(
149 "ppapi/tests/extensions/background_keepalive/newlib"); 148 "ppapi/tests/extensions/background_keepalive/newlib");
150 extension_ = LoadExtension(app_dir); 149 extension_ = LoadExtension(app_dir);
151 ASSERT_TRUE(extension_); 150 ASSERT_TRUE(extension_);
152 } 151 }
153 152
154 private: 153 private:
155 const Extension* extension_; 154 const Extension* extension_;
156 }; 155 };
157 156
158 // Produces an extensions::ProcessManager::ImpulseCallbackForTesting callback 157 // Produces an extensions::ProcessManager::ImpulseCallbackForTesting callback
159 // that will match a specified goal and can be waited on. 158 // that will match a specified goal and can be waited on.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); 643 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
645 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); 644 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id());
646 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); 645 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied());
647 646
648 manager->SetKeepaliveImpulseDecrementCallbackForTesting( 647 manager->SetKeepaliveImpulseDecrementCallbackForTesting(
649 idle_impulse_counter.SetGoalAndGetCallback(1)); 648 idle_impulse_counter.SetGoalAndGetCallback(1));
650 nacl_modules_loaded.Reply("be idle"); 649 nacl_modules_loaded.Reply("be idle");
651 idle_impulse_counter.Wait(); 650 idle_impulse_counter.Wait();
652 #endif 651 #endif
653 } 652 }
654
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698