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/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
11 #include "chrome/browser/autocomplete/autocomplete_result.h" | 11 #include "chrome/browser/autocomplete/autocomplete_result.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/search_engines/template_url_service_factory.h" |
15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 16 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_tabstrip.h" | 20 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/omnibox/location_bar.h" | 22 #include "chrome/browser/ui/omnibox/location_bar.h" |
22 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 23 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
23 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 24 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
24 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
28 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
| 30 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
30 #include "content/public/browser/notification_service.h" | |
31 #include "content/public/common/url_constants.h" | 32 #include "content/public/common/url_constants.h" |
32 #include "content/public/test/browser_test_utils.h" | 33 #include "content/public/test/browser_test_utils.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
34 | 35 |
35 using content::WebContents; | 36 using content::WebContents; |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
39 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("popup_blocker"); | 40 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("popup_blocker"); |
40 | 41 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 std::string search_string = | 155 std::string search_string = |
155 "data:text/html,<title>Popup Success!</title>you should not see this " | 156 "data:text/html,<title>Popup Success!</title>you should not see this " |
156 "message if popup blocker is enabled"; | 157 "message if popup blocker is enabled"; |
157 | 158 |
158 ui_test_utils::HistoryEnumerator history(browser()->profile()); | 159 ui_test_utils::HistoryEnumerator history(browser()->profile()); |
159 std::vector<GURL>& history_urls = history.urls(); | 160 std::vector<GURL>& history_urls = history.urls(); |
160 ASSERT_EQ(2u, history_urls.size()); | 161 ASSERT_EQ(2u, history_urls.size()); |
161 ASSERT_EQ(GURL(search_string), history_urls[0]); | 162 ASSERT_EQ(GURL(search_string), history_urls[0]); |
162 ASSERT_EQ(url, history_urls[1]); | 163 ASSERT_EQ(url, history_urls[1]); |
163 | 164 |
| 165 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile( |
| 166 browser()->profile()); |
| 167 ui_test_utils::WaitForTemplateURLServiceToLoad(service); |
164 LocationBar* location_bar = browser()->window()->GetLocationBar(); | 168 LocationBar* location_bar = browser()->window()->GetLocationBar(); |
165 ui_test_utils::SendToOmniboxAndSubmit(location_bar, search_string); | 169 ui_test_utils::SendToOmniboxAndSubmit(location_bar, search_string); |
166 OmniboxEditModel* model = location_bar->GetLocationEntry()->model(); | 170 OmniboxEditModel* model = location_bar->GetLocationEntry()->model(); |
167 EXPECT_EQ(GURL(search_string), model->CurrentMatch().destination_url); | 171 EXPECT_EQ(GURL(search_string), model->CurrentMatch().destination_url); |
168 EXPECT_EQ(ASCIIToUTF16(search_string), model->CurrentMatch().contents); | 172 EXPECT_EQ(ASCIIToUTF16(search_string), model->CurrentMatch().contents); |
169 } | 173 } |
170 | 174 |
171 } // namespace | 175 } // namespace |
OLD | NEW |