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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 // GTK adjusts FindBar size asynchronously. | 1212 // GTK adjusts FindBar size asynchronously. |
1213 MessageLoop::current()->RunAllPending(); | 1213 MessageLoop::current()->RunAllPending(); |
1214 | 1214 |
1215 ASSERT_LE(GetFindBarWidthForBrowser(popup), | 1215 ASSERT_LE(GetFindBarWidthForBrowser(popup), |
1216 popup->window()->GetBounds().width()); | 1216 popup->window()->GetBounds().width()); |
1217 } | 1217 } |
1218 | 1218 |
1219 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 1219 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
1220 FindMovesOnTabClose_Issue1343052) { | 1220 FindMovesOnTabClose_Issue1343052) { |
1221 EnsureFindBoxOpen(); | 1221 EnsureFindBoxOpen(); |
1222 ui_test_utils::RunAllPendingInMessageLoop(); // Needed on Linux. | 1222 content::RunAllPendingInMessageLoop(); // Needed on Linux. |
1223 | 1223 |
1224 gfx::Point position; | 1224 gfx::Point position; |
1225 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1225 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
1226 | 1226 |
1227 // Open another tab. | 1227 // Open another tab. |
1228 GURL url = GetURL(kSimple); | 1228 GURL url = GetURL(kSimple); |
1229 ui_test_utils::NavigateToURLWithDisposition( | 1229 ui_test_utils::NavigateToURLWithDisposition( |
1230 browser(), url, NEW_FOREGROUND_TAB, | 1230 browser(), url, NEW_FOREGROUND_TAB, |
1231 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1231 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1232 | 1232 |
1233 // Close it. | 1233 // Close it. |
1234 chrome::CloseTab(browser()); | 1234 chrome::CloseTab(browser()); |
1235 | 1235 |
1236 // See if the Find window has moved. | 1236 // See if the Find window has moved. |
1237 gfx::Point position2; | 1237 gfx::Point position2; |
1238 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1238 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
1239 EXPECT_EQ(position, position2); | 1239 EXPECT_EQ(position, position2); |
1240 | 1240 |
1241 // Toggle the bookmark bar state. Note that this starts an animation, and | 1241 // Toggle the bookmark bar state. Note that this starts an animation, and |
1242 // there isn't a good way other than looping and polling to see when it's | 1242 // there isn't a good way other than looping and polling to see when it's |
1243 // done. So instead we change the state and open a new tab, since the new tab | 1243 // done. So instead we change the state and open a new tab, since the new tab |
1244 // animation doesn't happen on tab change. | 1244 // animation doesn't happen on tab change. |
1245 chrome::ToggleBookmarkBar(browser()); | 1245 chrome::ToggleBookmarkBar(browser()); |
1246 | 1246 |
1247 ui_test_utils::NavigateToURLWithDisposition( | 1247 ui_test_utils::NavigateToURLWithDisposition( |
1248 browser(), url, NEW_FOREGROUND_TAB, | 1248 browser(), url, NEW_FOREGROUND_TAB, |
1249 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1249 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1250 | 1250 |
1251 EnsureFindBoxOpen(); | 1251 EnsureFindBoxOpen(); |
1252 ui_test_utils::RunAllPendingInMessageLoop(); // Needed on Linux. | 1252 content::RunAllPendingInMessageLoop(); // Needed on Linux. |
1253 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1253 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
1254 | 1254 |
1255 ui_test_utils::NavigateToURLWithDisposition( | 1255 ui_test_utils::NavigateToURLWithDisposition( |
1256 browser(), url, NEW_FOREGROUND_TAB, | 1256 browser(), url, NEW_FOREGROUND_TAB, |
1257 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1257 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1258 chrome::CloseTab(browser()); | 1258 chrome::CloseTab(browser()); |
1259 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1259 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
1260 EXPECT_EQ(position, position2); | 1260 EXPECT_EQ(position, position2); |
1261 } | 1261 } |
OLD | NEW |