Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6906)

Unified Diff: chrome/browser/views/find_bar_host_browsertest.cc

Issue 553042: Attempt to fix a flaky test (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/find_in_page/move_if_obscuring.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/find_bar_host_browsertest.cc
===================================================================
--- chrome/browser/views/find_bar_host_browsertest.cc (revision 36660)
+++ chrome/browser/views/find_bar_host_browsertest.cc (working copy)
@@ -572,46 +572,35 @@
EXPECT_TRUE(GetFindBarWindowInfo(&start_position, &fully_visible));
EXPECT_TRUE(fully_visible);
- // Search for 'dream' which the Find box is obscuring.
+ // Search for 'Chromium' which the Find box is obscuring.
int ordinal = 0;
TabContents* tab = browser()->GetSelectedTabContents();
- EXPECT_EQ(1, FindInPageWchar(tab, L"dream",
- kFwd, kIgnoreCase, &ordinal));
- EXPECT_EQ(1, ordinal);
+ int index = 0;
+ for (; index < 30; ++index) {
Paweł Hajdan Jr. 2010/01/21 20:41:55 nit: Could you make 30 a constant (kIterations)?
+ EXPECT_EQ(30, FindInPageWchar(tab, L"Chromium",
+ kFwd, kIgnoreCase, &ordinal));
- // Make sure Find box has moved.
- EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
- EXPECT_TRUE(fully_visible);
- EXPECT_EQ(start_position.y(), position.y());
- if (start_position.x() == position.x()) {
- // Failure case. Try to gather more data.
- std::string debug_msg = "Position check failed once. ";
+ // Check the position.
+ EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
+ EXPECT_TRUE(fully_visible);
- // First see if flushing the message loop has any effect.
- MessageLoop::current()->RunAllPending();
-
- if (!GetFindBarWindowInfo(&position, &fully_visible)) {
- debug_msg += "Get failed. ";
- } else {
- if (start_position.x() == position.x())
- debug_msg += "Position check failed again. ";
- else
- debug_msg += "They now differ. ";
- }
- // Force the failure.
- EXPECT_STREQ("", debug_msg.c_str());
+ // If the Find box has moved then we are done.
+ if (position.x() != start_position.x())
+ break;
}
- EXPECT_NE(start_position.x(), position.x());
- // Search for 'Too much' which the Find box is not obscuring.
- EXPECT_EQ(1, FindInPageWchar(tab, L"Too much",
- kFwd, kIgnoreCase, &ordinal));
- EXPECT_EQ(1, ordinal);
+ // We should not have reached the end.
+ ASSERT_GT(30, index);
- // Make sure Find box has moved back to its original location.
+ // Search backwards once to get the Find box to move back.
+ EXPECT_EQ(30, FindInPageWchar(tab, L"Chromium",
+ kBack, kIgnoreCase, &ordinal));
+ // Check the position.
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
EXPECT_TRUE(fully_visible);
- EXPECT_EQ(start_position, position);
+
+ // Make sure Find box has moved back to its original location.
+ EXPECT_EQ(position.x(), start_position.x());
}
// Make sure F3 in a new tab works if Find has previous string to search for.
« no previous file with comments | « no previous file | chrome/test/data/find_in_page/move_if_obscuring.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698