| 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_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.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" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return blocked_contents; | 63 return blocked_contents; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void NavigateAndCheckPopupShown(Browser* browser, const GURL& url) { | 66 void NavigateAndCheckPopupShown(Browser* browser, const GURL& url) { |
| 67 content::WindowedNotificationObserver observer( | 67 content::WindowedNotificationObserver observer( |
| 68 chrome::NOTIFICATION_TAB_ADDED, | 68 chrome::NOTIFICATION_TAB_ADDED, |
| 69 content::NotificationService::AllSources()); | 69 content::NotificationService::AllSources()); |
| 70 ui_test_utils::NavigateToURL(browser, url); | 70 ui_test_utils::NavigateToURL(browser, url); |
| 71 observer.Wait(); | 71 observer.Wait(); |
| 72 | 72 |
| 73 ASSERT_EQ(2u, chrome::GetBrowserCount(browser->profile())); | 73 ASSERT_EQ(2u, chrome::GetBrowserCount(browser->profile(), |
| 74 browser->host_desktop_type())); |
| 74 | 75 |
| 75 std::vector<WebContents*> blocked_contents = GetBlockedContents(browser); | 76 std::vector<WebContents*> blocked_contents = GetBlockedContents(browser); |
| 76 ASSERT_TRUE(blocked_contents.empty()); | 77 ASSERT_TRUE(blocked_contents.empty()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void BasicTest(Browser* browser) { | 80 void BasicTest(Browser* browser) { |
| 80 GURL url(GetTestURL()); | 81 GURL url(GetTestURL()); |
| 81 ui_test_utils::NavigateToURL(browser, url); | 82 ui_test_utils::NavigateToURL(browser, url); |
| 82 | 83 |
| 83 // If the popup blocker blocked the blank post, there should be only one | 84 // If the popup blocker blocked the blank post, there should be only one |
| 84 // tab in only one browser window and the URL of current tab must be equal | 85 // tab in only one browser window and the URL of current tab must be equal |
| 85 // to the original URL. | 86 // to the original URL. |
| 86 EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile())); | 87 EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile(), |
| 88 browser->host_desktop_type())); |
| 87 EXPECT_EQ(1, browser->tab_strip_model()->count()); | 89 EXPECT_EQ(1, browser->tab_strip_model()->count()); |
| 88 WebContents* web_contents = | 90 WebContents* web_contents = |
| 89 browser->tab_strip_model()->GetActiveWebContents(); | 91 browser->tab_strip_model()->GetActiveWebContents(); |
| 90 EXPECT_EQ(url, web_contents->GetURL()); | 92 EXPECT_EQ(url, web_contents->GetURL()); |
| 91 | 93 |
| 92 std::vector<WebContents*> blocked_contents = GetBlockedContents(browser); | 94 std::vector<WebContents*> blocked_contents = GetBlockedContents(browser); |
| 93 ASSERT_EQ(1u, blocked_contents.size()); | 95 ASSERT_EQ(1u, blocked_contents.size()); |
| 94 | 96 |
| 95 content::WindowedNotificationObserver observer( | 97 content::WindowedNotificationObserver observer( |
| 96 chrome::NOTIFICATION_TAB_ADDED, | 98 chrome::NOTIFICATION_TAB_ADDED, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 browser()->profile()); | 170 browser()->profile()); |
| 169 ui_test_utils::WaitForTemplateURLServiceToLoad(service); | 171 ui_test_utils::WaitForTemplateURLServiceToLoad(service); |
| 170 LocationBar* location_bar = browser()->window()->GetLocationBar(); | 172 LocationBar* location_bar = browser()->window()->GetLocationBar(); |
| 171 ui_test_utils::SendToOmniboxAndSubmit(location_bar, search_string); | 173 ui_test_utils::SendToOmniboxAndSubmit(location_bar, search_string); |
| 172 OmniboxEditModel* model = location_bar->GetLocationEntry()->model(); | 174 OmniboxEditModel* model = location_bar->GetLocationEntry()->model(); |
| 173 EXPECT_EQ(GURL(search_string), model->CurrentMatch().destination_url); | 175 EXPECT_EQ(GURL(search_string), model->CurrentMatch().destination_url); |
| 174 EXPECT_EQ(ASCIIToUTF16(search_string), model->CurrentMatch().contents); | 176 EXPECT_EQ(ASCIIToUTF16(search_string), model->CurrentMatch().contents); |
| 175 } | 177 } |
| 176 | 178 |
| 177 } // namespace | 179 } // namespace |
| OLD | NEW |