Commit 6f54b9b2 authored by finnur@chromium.org's avatar finnur@chromium.org

Re-enable a few find in page tests.

They had been disabled -- not due to inherent flakiness in the test itself, but due to an environment issue (bug 96594) which affects a good number of tests. I'm following the precedent of others by re-enabling these tests while we work on a solution for the underlying environment issue. Note: We've already had a regression due to the tests being disabled.

TBR=sky
BUG=145476, 128724, 152100, 177487

Review URL: https://chromiumcodereview.appspot.com/14295003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195201 0039d316-1c4b-4281-b951-d872f2087c98
parent 7a49f7e1
...@@ -31,16 +31,8 @@ using content::WebContents; ...@@ -31,16 +31,8 @@ using content::WebContents;
namespace { namespace {
// The delay waited after sending an OS simulated event.
static const int kActionDelayMs = 500;
static const char kSimplePage[] = "files/find_in_page/simple.html"; static const char kSimplePage[] = "files/find_in_page/simple.html";
void Checkpoint(const char* message, const base::TimeTicks& start_time) {
LOG(INFO) << message << " : "
<< (base::TimeTicks::Now() - start_time).InMilliseconds()
<< " ms" << std::flush;
}
class FindInPageTest : public InProcessBrowserTest { class FindInPageTest : public InProcessBrowserTest {
public: public:
FindInPageTest() { FindInPageTest() {
...@@ -65,13 +57,8 @@ class FindInPageTest : public InProcessBrowserTest { ...@@ -65,13 +57,8 @@ class FindInPageTest : public InProcessBrowserTest {
} // namespace } // namespace
// Fails often on Win, CrOS. http://crbug.com/145476, http://crbug.com/128724 // Flaky because the test server fails to start? See: http://crbug.com/96594.
#if defined(OS_WIN) || defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
#define MAYBE_CrashEscHandlers DISABLED_CrashEscHandlers
#else
#define MAYBE_CrashEscHandlers CrashEscHandlers
#endif
IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page (tab A). // First we navigate to our test page (tab A).
...@@ -105,13 +92,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) { ...@@ -105,13 +92,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) {
browser(), ui::VKEY_ESCAPE, false, false, false, false)); browser(), ui::VKEY_ESCAPE, false, false, false, false));
} }
// Fails to start the test server on ChromeOS: http://crbug.com/168974 // Flaky because the test server fails to start? See: http://crbug.com/96594.
#if defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) {
#define MAYBE_FocusRestore DISABLED_FocusRestore
#else
#define MAYBE_FocusRestore FocusRestore
#endif
IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
GURL url = test_server()->GetURL("title1.html"); GURL url = test_server()->GetURL("title1.html");
...@@ -158,13 +140,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) { ...@@ -158,13 +140,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) {
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
} }
// Fails often on Win, CrOS. http://crbug.com/145476, http://crbug.com/128724 // Flaky because the test server fails to start? See: http://crbug.com/96594.
#if defined(OS_WIN) || defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestoreOnTabSwitch) {
#define MAYBE_FocusRestoreOnTabSwitch DISABLED_FocusRestoreOnTabSwitch
#else
#define MAYBE_FocusRestoreOnTabSwitch FocusRestoreOnTabSwitch
#endif
IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestoreOnTabSwitch) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page (tab A). // First we navigate to our test page (tab A).
...@@ -217,43 +194,28 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestoreOnTabSwitch) { ...@@ -217,43 +194,28 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestoreOnTabSwitch) {
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
} }
// Flaky on XP: http://crbug.com/152100 // Flaky because the test server fails to start? See: http://crbug.com/96594.
// Flaky on ChromiumOS: http://crbug.com/177487
#if defined(OS_WIN) || defined(OS_CHROMEOS)
#define MAYBE_PrepopulateRespectBlank DISABLED_PrepopulateRespectBlank
#else
#define MAYBE_PrepopulateRespectBlank PrepopulateRespectBlank
#endif
// This tests that whenever you clear values from the Find box and close it that // This tests that whenever you clear values from the Find box and close it that
// it respects that and doesn't show you the last search, as reported in bug: // it respects that and doesn't show you the last search, as reported in bug:
// http://crbug.com/40121. // http://crbug.com/40121.
IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PrepopulateRespectBlank) { IN_PROC_BROWSER_TEST_F(FindInPageTest, PrepopulateRespectBlank) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// FindInPage on Mac doesn't use prepopulated values. Search there is global. // FindInPage on Mac doesn't use prepopulated values. Search there is global.
return; return;
#endif #endif
base::TimeTicks start_time = base::TimeTicks::Now();
Checkpoint("Test starting", start_time);
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
// Make sure Chrome is in the foreground, otherwise sending input // Make sure Chrome is in the foreground, otherwise sending input
// won't do anything and the test will hang. // won't do anything and the test will hang.
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
Checkpoint("Navigate", start_time);
// First we navigate to any page. // First we navigate to any page.
GURL url = test_server()->GetURL(kSimplePage); GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url); ui_test_utils::NavigateToURL(browser(), url);
Checkpoint("Show Find bar", start_time);
// Show the Find bar. // Show the Find bar.
browser()->GetFindBarController()->Show(); browser()->GetFindBarController()->Show();
Checkpoint("Search for 'a'", start_time);
// Search for "a". // Search for "a".
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), ui::VKEY_A, false, false, false, false)); browser(), ui::VKEY_A, false, false, false, false));
...@@ -261,8 +223,6 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PrepopulateRespectBlank) { ...@@ -261,8 +223,6 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PrepopulateRespectBlank) {
// We should find "a" here. // We should find "a" here.
EXPECT_EQ(ASCIIToUTF16("a"), GetFindBarText()); EXPECT_EQ(ASCIIToUTF16("a"), GetFindBarText());
Checkpoint("Delete 'a'", start_time);
// Delete "a". // Delete "a".
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), ui::VKEY_BACK, false, false, false, false)); browser(), ui::VKEY_BACK, false, false, false, false));
...@@ -270,42 +230,28 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PrepopulateRespectBlank) { ...@@ -270,42 +230,28 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PrepopulateRespectBlank) {
// Validate we have cleared the text. // Validate we have cleared the text.
EXPECT_EQ(string16(), GetFindBarText()); EXPECT_EQ(string16(), GetFindBarText());
Checkpoint("Close find bar", start_time);
// Close the Find box. // Close the Find box.
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), ui::VKEY_ESCAPE, false, false, false, false)); browser(), ui::VKEY_ESCAPE, false, false, false, false));
Checkpoint("Show Find bar", start_time);
// Show the Find bar. // Show the Find bar.
browser()->GetFindBarController()->Show(); browser()->GetFindBarController()->Show();
Checkpoint("Validate text", start_time);
// After the Find box has been reopened, it should not have been prepopulated // After the Find box has been reopened, it should not have been prepopulated
// with "a" again. // with "a" again.
EXPECT_EQ(string16(), GetFindBarText()); EXPECT_EQ(string16(), GetFindBarText());
Checkpoint("Close Find bar", start_time);
// Close the Find box. // Close the Find box.
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), ui::VKEY_ESCAPE, false, false, false, false)); browser(), ui::VKEY_ESCAPE, false, false, false, false));
Checkpoint("FindNext", start_time);
// Press F3 to trigger FindNext. // Press F3 to trigger FindNext.
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), ui::VKEY_F3, false, false, false, false)); browser(), ui::VKEY_F3, false, false, false, false));
Checkpoint("Validate", start_time);
// After the Find box has been reopened, it should still have no prepopulate // After the Find box has been reopened, it should still have no prepopulate
// value. // value.
EXPECT_EQ(string16(), GetFindBarText()); EXPECT_EQ(string16(), GetFindBarText());
Checkpoint("Test done", start_time);
} }
// Flaky on Win. http://crbug.com/92467 // Flaky on Win. http://crbug.com/92467
......
...@@ -192,7 +192,7 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, ...@@ -192,7 +192,7 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result,
// composed by them. To avoid this problem, we should check the IME status and // composed by them. To avoid this problem, we should check the IME status and
// update the text only when the IME is not composing text. // update the text only when the IME is not composing text.
if (find_text_->text() != find_text && !find_text_->IsIMEComposing()) { if (find_text_->text() != find_text && !find_text_->IsIMEComposing()) {
find_text_->SetText(find_text); SetFindText(find_text);
find_text_->SelectAll(true); find_text_->SelectAll(true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment