OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <deque> | 5 #include <deque> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
13 #include "chrome/browser/browsing_data_remover.h" | 13 #include "chrome/browser/browsing_data_remover.h" |
14 #include "chrome/browser/content_settings/host_content_settings_map.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map.h" |
15 #include "chrome/browser/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
17 #include "chrome/browser/prerender/prerender_contents.h" | 17 #include "chrome/browser/prerender/prerender_contents.h" |
18 #include "chrome/browser/prerender/prerender_manager.h" | 18 #include "chrome/browser/prerender/prerender_manager.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 20 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
21 #include "chrome/browser/task_manager/task_manager.h" | 21 #include "chrome/browser/task_manager/task_manager.h" |
22 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | |
23 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
26 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
27 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
30 #include "chrome/test/base/in_process_browser_test.h" | 29 #include "chrome/test/base/in_process_browser_test.h" |
31 #include "chrome/test/base/ui_test_utils.h" | 30 #include "chrome/test/base/ui_test_utils.h" |
32 #include "content/browser/renderer_host/render_view_host.h" | 31 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 bool url_c_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileC); | 1046 bool url_c_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileC); |
1048 EXPECT_TRUE((url_b_is_active_prerender || url_c_is_active_prerender) && | 1047 EXPECT_TRUE((url_b_is_active_prerender || url_c_is_active_prerender) && |
1049 !(url_b_is_active_prerender && url_c_is_active_prerender)); | 1048 !(url_b_is_active_prerender && url_c_is_active_prerender)); |
1050 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileB)); | 1049 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileB)); |
1051 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileC)); | 1050 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileC)); |
1052 } | 1051 } |
1053 | 1052 |
1054 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTaskManager) { | 1053 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTaskManager) { |
1055 // Show the task manager. This populates the model. | 1054 // Show the task manager. This populates the model. |
1056 browser()->window()->ShowTaskManager(); | 1055 browser()->window()->ShowTaskManager(); |
1057 // Wait for the model of task manager to start. | |
1058 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | |
1059 | 1056 |
1060 // Start with two resources. | 1057 // Start with two resources. |
1061 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 1058 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
1062 | 1059 |
1063 // One of the resources that has a TabContents associated with it should have | 1060 // One of the resources that has a TabContents associated with it should have |
1064 // the Prerender prefix. | 1061 // the Prerender prefix. |
1065 const string16 prefix = | 1062 const string16 prefix = |
1066 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); | 1063 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); |
1067 string16 prerender_title; | 1064 string16 prerender_title; |
1068 int num_prerender_tabs = 0; | 1065 int num_prerender_tabs = 0; |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 1); | 1602 1); |
1606 // Post a task to cancel all the prerenders. | 1603 // Post a task to cancel all the prerenders. |
1607 MessageLoop::current()->PostTask(FROM_HERE, | 1604 MessageLoop::current()->PostTask(FROM_HERE, |
1608 NewRunnableFunction(CancelAllPrerenders, | 1605 NewRunnableFunction(CancelAllPrerenders, |
1609 prerender_manager())); | 1606 prerender_manager())); |
1610 ui_test_utils::RunMessageLoop(); | 1607 ui_test_utils::RunMessageLoop(); |
1611 EXPECT_TRUE(GetPrerenderContents() == NULL); | 1608 EXPECT_TRUE(GetPrerenderContents() == NULL); |
1612 } | 1609 } |
1613 | 1610 |
1614 } // namespace prerender | 1611 } // namespace prerender |
OLD | NEW |