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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/string16.h" | 6 #include "base/string16.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 EnsureFindBoxOpenForBrowser(browser()); | 1120 EnsureFindBoxOpenForBrowser(browser()); |
1121 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); | 1121 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); |
1122 | 1122 |
1123 // Close the Find box. | 1123 // Close the Find box. |
1124 browser()->GetFindBarController()->EndFindSession( | 1124 browser()->GetFindBarController()->EndFindSession( |
1125 FindBarController::kKeepSelectionOnPage, | 1125 FindBarController::kKeepSelectionOnPage, |
1126 FindBarController::kKeepResultsInFindBox); | 1126 FindBarController::kKeepResultsInFindBox); |
1127 | 1127 |
1128 // Open a new incognito window and navigate to the same page. | 1128 // Open a new incognito window and navigate to the same page. |
1129 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 1129 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
1130 Browser* incognito_browser = Browser::Create(incognito_profile); | 1130 Browser* incognito_browser = |
| 1131 new Browser(Browser::CreateParams(incognito_profile)); |
1131 content::WindowedNotificationObserver observer( | 1132 content::WindowedNotificationObserver observer( |
1132 content::NOTIFICATION_LOAD_STOP, | 1133 content::NOTIFICATION_LOAD_STOP, |
1133 content::NotificationService::AllSources()); | 1134 content::NotificationService::AllSources()); |
1134 chrome::AddSelectedTabWithURL(incognito_browser, url, | 1135 chrome::AddSelectedTabWithURL(incognito_browser, url, |
1135 content::PAGE_TRANSITION_START_PAGE); | 1136 content::PAGE_TRANSITION_START_PAGE); |
1136 observer.Wait(); | 1137 observer.Wait(); |
1137 incognito_browser->window()->Show(); | 1138 incognito_browser->window()->Show(); |
1138 | 1139 |
1139 // Open the find box and make sure that it is prepopulated with "page". | 1140 // Open the find box and make sure that it is prepopulated with "page". |
1140 EnsureFindBoxOpenForBrowser(incognito_browser); | 1141 EnsureFindBoxOpenForBrowser(incognito_browser); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 // Tests that FindBar fits within a narrow browser window. | 1187 // Tests that FindBar fits within a narrow browser window. |
1187 // Flaky on Linux/GTK: http://crbug.com/136443. | 1188 // Flaky on Linux/GTK: http://crbug.com/136443. |
1188 #if defined(TOOLKIT_GTK) | 1189 #if defined(TOOLKIT_GTK) |
1189 #define MAYBE_FitWindow DISABLED_FitWindow | 1190 #define MAYBE_FitWindow DISABLED_FitWindow |
1190 #else | 1191 #else |
1191 #define MAYBE_FitWindow FitWindow | 1192 #define MAYBE_FitWindow FitWindow |
1192 #endif | 1193 #endif |
1193 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FitWindow) { | 1194 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FitWindow) { |
1194 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); | 1195 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); |
1195 params.initial_bounds = gfx::Rect(0, 0, 250, 500); | 1196 params.initial_bounds = gfx::Rect(0, 0, 250, 500); |
1196 Browser* popup = Browser::CreateWithParams(params); | 1197 Browser* popup = new Browser(params); |
1197 content::WindowedNotificationObserver observer( | 1198 content::WindowedNotificationObserver observer( |
1198 content::NOTIFICATION_LOAD_STOP, | 1199 content::NOTIFICATION_LOAD_STOP, |
1199 content::NotificationService::AllSources()); | 1200 content::NotificationService::AllSources()); |
1200 chrome::AddSelectedTabWithURL(popup, GURL(chrome::kAboutBlankURL), | 1201 chrome::AddSelectedTabWithURL(popup, GURL(chrome::kAboutBlankURL), |
1201 content::PAGE_TRANSITION_LINK); | 1202 content::PAGE_TRANSITION_LINK); |
1202 // Wait for the page to finish loading. | 1203 // Wait for the page to finish loading. |
1203 observer.Wait(); | 1204 observer.Wait(); |
1204 popup->window()->Show(); | 1205 popup->window()->Show(); |
1205 | 1206 |
1206 // On GTK, bounds change is asynchronous. | 1207 // On GTK, bounds change is asynchronous. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 ui_test_utils::RunAllPendingInMessageLoop(); // Needed on Linux. | 1252 ui_test_utils::RunAllPendingInMessageLoop(); // Needed on Linux. |
1252 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1253 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
1253 | 1254 |
1254 ui_test_utils::NavigateToURLWithDisposition( | 1255 ui_test_utils::NavigateToURLWithDisposition( |
1255 browser(), url, NEW_FOREGROUND_TAB, | 1256 browser(), url, NEW_FOREGROUND_TAB, |
1256 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1257 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1257 chrome::CloseTab(browser()); | 1258 chrome::CloseTab(browser()); |
1258 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1259 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
1259 EXPECT_EQ(position, position2); | 1260 EXPECT_EQ(position, position2); |
1260 } | 1261 } |
OLD | NEW |