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 "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" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 121 |
122 // Fixture to assist in testing v2 app background pages containing | 122 // Fixture to assist in testing v2 app background pages containing |
123 // Native Client embeds. | 123 // Native Client embeds. |
124 class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest { | 124 class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest { |
125 public: | 125 public: |
126 AppBackgroundPageNaClTest() | 126 AppBackgroundPageNaClTest() |
127 : extension_(NULL) {} | 127 : extension_(NULL) {} |
128 virtual ~AppBackgroundPageNaClTest() { | 128 virtual ~AppBackgroundPageNaClTest() { |
129 } | 129 } |
130 | 130 |
131 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 131 virtual void SetUpOnMainThread() OVERRIDE { |
132 AppBackgroundPageApiTest::SetUpCommandLine(command_line); | 132 AppBackgroundPageApiTest::SetUpOnMainThread(); |
133 #if !defined(DISABLE_NACL) | 133 #if !defined(DISABLE_NACL) |
134 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50); | 134 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50); |
135 #endif | 135 #endif |
136 command_line->AppendSwitchASCII( | 136 extensions::ProcessManager::SetEventPageIdleTimeForTesting(100); |
Devlin
2014/09/05 22:06:07
include?
Yoyo Zhou
2014/09/08 16:19:10
Done.
| |
137 extensions::switches::kEventPageIdleTime, "1000"); | 137 extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(100); |
138 command_line->AppendSwitchASCII( | |
139 extensions::switches::kEventPageSuspendingTime, "1000"); | |
140 } | 138 } |
141 | 139 |
142 const Extension* extension() { return extension_; } | 140 const Extension* extension() { return extension_; } |
143 | 141 |
144 protected: | 142 protected: |
145 void LaunchTestingApp() { | 143 void LaunchTestingApp() { |
146 base::FilePath app_dir; | 144 base::FilePath app_dir; |
147 PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir); | 145 PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir); |
148 app_dir = app_dir.AppendASCII( | 146 app_dir = app_dir.AppendASCII( |
149 "ppapi/tests/extensions/background_keepalive/newlib"); | 147 "ppapi/tests/extensions/background_keepalive/newlib"); |
150 extension_ = LoadExtension(app_dir); | 148 extension_ = LoadExtension(app_dir); |
151 ASSERT_TRUE(extension_); | 149 ASSERT_TRUE(extension_); |
152 } | 150 } |
153 | 151 |
154 private: | 152 private: |
155 const Extension* extension_; | 153 const Extension* extension_; |
156 }; | 154 }; |
157 | 155 |
158 // Produces an extensions::ProcessManager::ImpulseCallbackForTesting callback | 156 // Produces an extensions::ProcessManager::ImpulseCallbackForTesting callback |
159 // that will match a specified goal and can be waited on. | 157 // that will match a specified goal and can be waited on. |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
644 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 642 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
645 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); | 643 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); |
646 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); | 644 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); |
647 | 645 |
648 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 646 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
649 idle_impulse_counter.SetGoalAndGetCallback(1)); | 647 idle_impulse_counter.SetGoalAndGetCallback(1)); |
650 nacl_modules_loaded.Reply("be idle"); | 648 nacl_modules_loaded.Reply("be idle"); |
651 idle_impulse_counter.Wait(); | 649 idle_impulse_counter.Wait(); |
652 #endif | 650 #endif |
653 } | 651 } |
654 | |
OLD | NEW |