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/location.h" | 5 #include "base/location.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "chrome/browser/background/background_contents_service.h" | 12 #include "chrome/browser/background/background_contents_service.h" |
13 #include "chrome/browser/background/background_contents_service_factory.h" | 13 #include "chrome/browser/background/background_contents_service_factory.h" |
14 #include "chrome/browser/background/background_mode_manager.h" | 14 #include "chrome/browser/background/background_mode_manager.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/extensions/extension_apitest.h" | 16 #include "chrome/browser/extensions/extension_apitest.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | |
20 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/browser_dialogs.h" | 20 #include "chrome/browser/ui/browser_dialogs.h" |
22 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
23 #include "chrome/browser/ui/extensions/application_launch.h" | 22 #include "chrome/browser/ui/extensions/application_launch.h" |
24 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
26 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
27 #include "content/public/test/test_notification_tracker.h" | 26 #include "content/public/test/test_notification_tracker.h" |
28 #include "content/public/test/test_utils.h" | 27 #include "content/public/test/test_utils.h" |
29 #include "extensions/browser/process_manager.h" | 28 #include "extensions/browser/process_manager.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 ASSERT_TRUE( | 300 ASSERT_TRUE( |
302 BackgroundContentsServiceFactory::GetForProfile(browser()->profile())-> | 301 BackgroundContentsServiceFactory::GetForProfile(browser()->profile())-> |
303 GetAppBackgroundContents(ASCIIToUTF16(extension->id()))); | 302 GetAppBackgroundContents(ASCIIToUTF16(extension->id()))); |
304 UnloadExtension(extension->id()); | 303 UnloadExtension(extension->id()); |
305 } | 304 } |
306 | 305 |
307 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { | 306 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { |
308 // Keep the task manager up through this test to verify that a crash doesn't | 307 // Keep the task manager up through this test to verify that a crash doesn't |
309 // happen when window.open creates a background page that switches | 308 // happen when window.open creates a background page that switches |
310 // RenderViewHosts. See http://crbug.com/165138. | 309 // RenderViewHosts. See http://crbug.com/165138. |
311 // This test is for the old implementation of the task manager. We must | |
312 // explicitly disable the new one. | |
313 task_manager::browsertest_util::EnableOldTaskManager(); | |
314 chrome::ShowTaskManager(browser()); | 310 chrome::ShowTaskManager(browser()); |
315 | 311 |
316 // Make sure that no BackgroundContentses get deleted (a signal that repeated | 312 // Make sure that no BackgroundContentses get deleted (a signal that repeated |
317 // window.open calls recreate instances, instead of being no-ops). | 313 // window.open calls recreate instances, instead of being no-ops). |
318 content::TestNotificationTracker background_deleted_tracker; | 314 content::TestNotificationTracker background_deleted_tracker; |
319 background_deleted_tracker.ListenFor( | 315 background_deleted_tracker.ListenFor( |
320 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, | 316 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, |
321 content::Source<Profile>(browser()->profile())); | 317 content::Source<Profile>(browser()->profile())); |
322 | 318 |
323 host_resolver()->AddRule("a.com", "127.0.0.1"); | 319 host_resolver()->AddRule("a.com", "127.0.0.1"); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 extensions::ProcessManager::Get(browser()->profile()); | 633 extensions::ProcessManager::Get(browser()->profile()); |
638 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); | 634 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); |
639 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); | 635 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); |
640 | 636 |
641 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 637 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
642 idle_impulse_counter.SetGoalAndGetCallback(1)); | 638 idle_impulse_counter.SetGoalAndGetCallback(1)); |
643 nacl_modules_loaded.Reply("be idle"); | 639 nacl_modules_loaded.Reply("be idle"); |
644 idle_impulse_counter.Wait(); | 640 idle_impulse_counter.Wait(); |
645 #endif | 641 #endif |
646 } | 642 } |
OLD | NEW |