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

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

Issue 1293813005: Change the new-task-manager flag so that the new implementation is enabled by default for all users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 5 years, 4 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/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 "chrome/browser/background/background_contents_service.h" 11 #include "chrome/browser/background/background_contents_service.h"
12 #include "chrome/browser/background/background_contents_service_factory.h" 12 #include "chrome/browser/background/background_contents_service_factory.h"
13 #include "chrome/browser/background/background_mode_manager.h" 13 #include "chrome/browser/background/background_mode_manager.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/extensions/extension_apitest.h" 15 #include "chrome/browser/extensions/extension_apitest.h"
16 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_dialogs.h" 20 #include "chrome/browser/ui/browser_dialogs.h"
20 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/extensions/application_launch.h" 22 #include "chrome/browser/ui/extensions/application_launch.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25 #include "content/public/test/test_notification_tracker.h" 26 #include "content/public/test/test_notification_tracker.h"
26 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
27 #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
299 ASSERT_TRUE( 300 ASSERT_TRUE(
300 BackgroundContentsServiceFactory::GetForProfile(browser()->profile())-> 301 BackgroundContentsServiceFactory::GetForProfile(browser()->profile())->
301 GetAppBackgroundContents(ASCIIToUTF16(extension->id()))); 302 GetAppBackgroundContents(ASCIIToUTF16(extension->id())));
302 UnloadExtension(extension->id()); 303 UnloadExtension(extension->id());
303 } 304 }
304 305
305 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { 306 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) {
306 // 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
307 // happen when window.open creates a background page that switches 308 // happen when window.open creates a background page that switches
308 // RenderViewHosts. See http://crbug.com/165138. 309 // RenderViewHosts. See http://crbug.com/165138.
310 // This test is for the old implementation of the task manager. We must
311 // explicitly disable the new one.
312 task_manager::browsertest_util::EnableOldTaskManager();
309 chrome::ShowTaskManager(browser()); 313 chrome::ShowTaskManager(browser());
310 314
311 // Make sure that no BackgroundContentses get deleted (a signal that repeated 315 // Make sure that no BackgroundContentses get deleted (a signal that repeated
312 // window.open calls recreate instances, instead of being no-ops). 316 // window.open calls recreate instances, instead of being no-ops).
313 content::TestNotificationTracker background_deleted_tracker; 317 content::TestNotificationTracker background_deleted_tracker;
314 background_deleted_tracker.ListenFor( 318 background_deleted_tracker.ListenFor(
315 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, 319 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED,
316 content::Source<Profile>(browser()->profile())); 320 content::Source<Profile>(browser()->profile()));
317 321
318 host_resolver()->AddRule("a.com", "127.0.0.1"); 322 host_resolver()->AddRule("a.com", "127.0.0.1");
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 extensions::ProcessManager::Get(browser()->profile()); 636 extensions::ProcessManager::Get(browser()->profile());
633 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); 637 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id());
634 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); 638 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied());
635 639
636 manager->SetKeepaliveImpulseDecrementCallbackForTesting( 640 manager->SetKeepaliveImpulseDecrementCallbackForTesting(
637 idle_impulse_counter.SetGoalAndGetCallback(1)); 641 idle_impulse_counter.SetGoalAndGetCallback(1));
638 nacl_modules_loaded.Reply("be idle"); 642 nacl_modules_loaded.Reply("be idle");
639 idle_impulse_counter.Wait(); 643 idle_impulse_counter.Wait();
640 #endif 644 #endif
641 } 645 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/processes/processes_apitest.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698