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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/instant/instant_controller.h" | 10 #include "chrome/browser/instant/instant_controller.h" |
11 #include "chrome/browser/instant/instant_loader.h" | 11 #include "chrome/browser/instant/instant_loader.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/search_engines/template_url.h" | 14 #include "chrome/browser/search_engines/template_url.h" |
15 #include "chrome/browser/search_engines/template_url_service.h" | 15 #include "chrome/browser/search_engines/template_url_service.h" |
16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "chrome/browser/search_engines/template_url_service_factory.h" |
17 #include "chrome/browser/task_manager/task_manager.h" | 17 #include "chrome/browser/task_manager/task_manager.h" |
18 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 18 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_instant_controller.h" |
20 #include "chrome/browser/ui/browser_tabstrip.h" | 21 #include "chrome/browser/ui/browser_tabstrip.h" |
21 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
22 #include "chrome/browser/ui/omnibox/location_bar.h" | 23 #include "chrome/browser/ui/omnibox/location_bar.h" |
23 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 24 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
24 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 25 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
25 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 26 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
26 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.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/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 // Sends a message to the renderer and waits for the response to come back to | 109 // Sends a message to the renderer and waits for the response to come back to |
109 // the browser. Returns true on success. | 110 // the browser. Returns true on success. |
110 bool WaitForMessageToBeProcessedByRenderer() { | 111 bool WaitForMessageToBeProcessedByRenderer() { |
111 bool result = false; | 112 bool result = false; |
112 return GetBoolFromJavascript(preview()->web_contents(), "true", &result) && | 113 return GetBoolFromJavascript(preview()->web_contents(), "true", &result) && |
113 result; | 114 result; |
114 } | 115 } |
115 | 116 |
116 InstantController* instant() const { | 117 InstantController* instant() const { |
117 return browser()->instant(); | 118 return browser()->instant_controller()->instant(); |
118 } | 119 } |
119 | 120 |
120 OmniboxView* omnibox() const { | 121 OmniboxView* omnibox() const { |
121 return browser()->window()->GetLocationBar()->GetLocationEntry(); | 122 return browser()->window()->GetLocationBar()->GetLocationEntry(); |
122 } | 123 } |
123 | 124 |
124 TabContents* preview() const { | 125 TabContents* preview() const { |
125 return instant()->GetPreviewContents(); | 126 return instant()->GetPreviewContents(); |
126 } | 127 } |
127 | 128 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 DetermineInstantSupport(); | 837 DetermineInstantSupport(); |
837 SearchAndWaitForPreviewToShow(); | 838 SearchAndWaitForPreviewToShow(); |
838 | 839 |
839 // Now there should be three rows, the third being the instant preview. | 840 // Now there should be three rows, the third being the instant preview. |
840 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 841 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
841 string16 prefix = l10n_util::GetStringFUTF16( | 842 string16 prefix = l10n_util::GetStringFUTF16( |
842 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); | 843 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); |
843 string16 title = task_manager->GetResourceTitle(2); | 844 string16 title = task_manager->GetResourceTitle(2); |
844 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; | 845 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; |
845 } | 846 } |
OLD | NEW |