OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
6 #include "chrome/browser/history/history_service_factory.h" | 6 #include "chrome/browser/history/history_service_factory.h" |
7 #include "chrome/browser/instant/instant_loader.h" | 7 #include "chrome/browser/instant/instant_loader.h" |
8 #include "chrome/browser/instant/instant_service.h" | 8 #include "chrome/browser/instant/instant_service.h" |
9 #include "chrome/browser/instant/instant_service_factory.h" | 9 #include "chrome/browser/instant/instant_service_factory.h" |
10 #include "chrome/browser/instant/instant_test_utils.h" | 10 #include "chrome/browser/instant/instant_test_utils.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/search_engines/template_url_service.h" | 12 #include "chrome/browser/search_engines/template_url_service.h" |
13 #include "chrome/browser/search_engines/template_url_service_factory.h" | 13 #include "chrome/browser/search_engines/template_url_service_factory.h" |
14 #include "chrome/browser/task_manager/task_manager.h" | 14 #include "chrome/browser/task_manager/task_manager.h" |
15 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 15 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
17 #include "chrome/browser/ui/browser_tabstrip.h" | |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "chrome/test/base/interactive_test_utils.h" | 20 #include "chrome/test/base/interactive_test_utils.h" |
21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 | 26 |
27 class InstantTest : public InstantTestBase { | 27 class InstantTest : public InstantTestBase { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 #define MAYBE_OnChangeEvent OnChangeEvent | 140 #define MAYBE_OnChangeEvent OnChangeEvent |
141 #endif | 141 #endif |
142 // Test that the onchange event is dispatched upon typing in the omnibox. | 142 // Test that the onchange event is dispatched upon typing in the omnibox. |
143 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_OnChangeEvent) { | 143 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_OnChangeEvent) { |
144 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 144 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
145 FocusOmniboxAndWaitForInstantSupport(); | 145 FocusOmniboxAndWaitForInstantSupport(); |
146 | 146 |
147 // Use the Instant page as the active tab, so we can exploit its visibility | 147 // Use the Instant page as the active tab, so we can exploit its visibility |
148 // handler to check visibility transitions. | 148 // handler to check visibility transitions. |
149 ui_test_utils::NavigateToURL(browser(), instant_url_); | 149 ui_test_utils::NavigateToURL(browser(), instant_url_); |
150 content::WebContents* active_tab = chrome::GetActiveWebContents(browser()); | 150 content::WebContents* active_tab = |
| 151 browser()->tab_strip_model()->GetActiveWebContents(); |
151 | 152 |
152 int active_tab_onvisibilitycalls = -1; | 153 int active_tab_onvisibilitycalls = -1; |
153 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", | 154 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", |
154 &active_tab_onvisibilitycalls)); | 155 &active_tab_onvisibilitycalls)); |
155 EXPECT_EQ(0, active_tab_onvisibilitycalls); | 156 EXPECT_EQ(0, active_tab_onvisibilitycalls); |
156 | 157 |
157 // Typing "query" into the omnibox causes one or more onchange events. The | 158 // Typing "query" into the omnibox causes one or more onchange events. The |
158 // page suggested "query suggestion" is inline autocompleted into the omnibox, | 159 // page suggested "query suggestion" is inline autocompleted into the omnibox, |
159 // causing another onchange event. | 160 // causing another onchange event. |
160 SetOmniboxTextAndWaitForInstantToShow("query"); | 161 SetOmniboxTextAndWaitForInstantToShow("query"); |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 content::WebContents* active_tab = | 1016 content::WebContents* active_tab = |
1016 browser()->tab_strip_model()->GetActiveWebContents(); | 1017 browser()->tab_strip_model()->GetActiveWebContents(); |
1017 EXPECT_TRUE(instant_service->IsInstantProcess( | 1018 EXPECT_TRUE(instant_service->IsInstantProcess( |
1018 active_tab->GetRenderProcessHost()->GetID())); | 1019 active_tab->GetRenderProcessHost()->GetID())); |
1019 | 1020 |
1020 // Navigating away should change the process. | 1021 // Navigating away should change the process. |
1021 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 1022 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
1022 EXPECT_FALSE(instant_service->IsInstantProcess( | 1023 EXPECT_FALSE(instant_service->IsInstantProcess( |
1023 active_tab->GetRenderProcessHost()->GetID())); | 1024 active_tab->GetRenderProcessHost()->GetID())); |
1024 } | 1025 } |
OLD | NEW |