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" |
22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
25 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "chrome/test/base/in_process_browser_test.h" | 30 #include "chrome/test/base/in_process_browser_test.h" |
30 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
31 #include "content/browser/renderer_host/render_view_host.h" | 32 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 bool url_c_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileC); | 1047 bool url_c_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileC); |
1047 EXPECT_TRUE((url_b_is_active_prerender || url_c_is_active_prerender) && | 1048 EXPECT_TRUE((url_b_is_active_prerender || url_c_is_active_prerender) && |
1048 !(url_b_is_active_prerender && url_c_is_active_prerender)); | 1049 !(url_b_is_active_prerender && url_c_is_active_prerender)); |
1049 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileB)); | 1050 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileB)); |
1050 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileC)); | 1051 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileC)); |
1051 } | 1052 } |
1052 | 1053 |
1053 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTaskManager) { | 1054 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTaskManager) { |
1054 // Show the task manager. This populates the model. | 1055 // Show the task manager. This populates the model. |
1055 browser()->window()->ShowTaskManager(); | 1056 browser()->window()->ShowTaskManager(); |
| 1057 // Wait for the model of task manager to start. |
| 1058 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
1056 | 1059 |
1057 // Start with two resources. | 1060 // Start with two resources. |
1058 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 1061 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
1059 | 1062 |
1060 // One of the resources that has a TabContents associated with it should have | 1063 // One of the resources that has a TabContents associated with it should have |
1061 // the Prerender prefix. | 1064 // the Prerender prefix. |
1062 const string16 prefix = | 1065 const string16 prefix = |
1063 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); | 1066 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); |
1064 string16 prerender_title; | 1067 string16 prerender_title; |
1065 int num_prerender_tabs = 0; | 1068 int num_prerender_tabs = 0; |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 1); | 1605 1); |
1603 // Post a task to cancel all the prerenders. | 1606 // Post a task to cancel all the prerenders. |
1604 MessageLoop::current()->PostTask(FROM_HERE, | 1607 MessageLoop::current()->PostTask(FROM_HERE, |
1605 NewRunnableFunction(CancelAllPrerenders, | 1608 NewRunnableFunction(CancelAllPrerenders, |
1606 prerender_manager())); | 1609 prerender_manager())); |
1607 ui_test_utils::RunMessageLoop(); | 1610 ui_test_utils::RunMessageLoop(); |
1608 EXPECT_TRUE(GetPrerenderContents() == NULL); | 1611 EXPECT_TRUE(GetPrerenderContents() == NULL); |
1609 } | 1612 } |
1610 | 1613 |
1611 } // namespace prerender | 1614 } // namespace prerender |
OLD | NEW |