summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/ui')
-rw-r--r--chrome/test/ui/ui_test.cc21
-rw-r--r--chrome/test/ui/ui_test.h12
2 files changed, 27 insertions, 6 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 22678ff..d2d619f 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -114,7 +114,9 @@ void UITest::TearDown() {
std::wstring error_msg =
L"Encountered an unexpected crash in the program during this test.";
if (expected_crashes_ > 0 && actual_crashes == 0)
- error_msg += L" Have you started crash_service.exe?";
+ error_msg += L" NOTE: This test is expected to fail if crash_service.exe "
+ L"is not running. Start it manually before running this "
+ L"test (see the build output directory).";
EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg;
}
@@ -359,6 +361,21 @@ bool UITest::WaitForDownloadShelfVisible(TabProxy* tab) {
return false;
}
+bool UITest::WaitForFindWindowFullyVisible(TabProxy* tab) {
+ const int kCycles = 20;
+ for (int i = 0; i < kCycles; i++) {
+ bool visible = false;
+ if (!tab->IsFindWindowFullyVisible(&visible))
+ return false; // Some error.
+ if (visible)
+ return true; // Find window is visible.
+
+ // Give it a chance to catch up.
+ Sleep(kWaitForActionMaxMsec / kCycles);
+ }
+ return false;
+}
+
GURL UITest::GetActiveTabURL() {
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
if (!tab_proxy.get())
@@ -416,7 +433,7 @@ DictionaryValue* UITest::GetLocalState() {
}
DictionaryValue* UITest::GetDefaultProfilePreferences() {
- std::wstring path;
+ std::wstring path;
PathService::Get(chrome::DIR_USER_DATA, &path);
file_util::AppendToPath(&path, chrome::kNotSignedInProfile);
file_util::AppendToPath(&path, chrome::kPreferencesFilename);
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index f7f9257..20c8b1b 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_TEST_UI_UI_TEST_H__
-#define CHROME_TEST_UI_UI_TEST_H__
+#ifndef CHROME_TEST_UI_UI_TEST_H_
+#define CHROME_TEST_UI_UI_TEST_H_
// This file provides a common base for running UI unit tests, which operate
// the entire browser application in a separate process for holistic
@@ -122,6 +122,11 @@ class UITest : public testing::Test {
// as possible.
bool WaitForDownloadShelfVisible(TabProxy* tab);
+ // Waits until the Find window has become fully visible (and stopped
+ // animating) in the specified tab. This function can time out (return false)
+ // if the window doesn't appear within a specific time.
+ bool WaitForFindWindowFullyVisible(TabProxy* tab);
+
// Closes the specified browser. Returns true if the browser was closed.
// This call is blocking. |application_closed| is set to true if this was
// the last browser window (and therefore as a result of it closing the
@@ -345,5 +350,4 @@ std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) {
}
#endif // UNIT_TEST
-#endif // CHROME_TEST_UI_UI_TEST_H__
-
+#endif // CHROME_TEST_UI_UI_TEST_H_