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

Unified Diff: chrome/browser/ui/search/instant_test_utils.cc

Issue 14130012: InstantExtendedManualTests should fail and not hang (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: virtual dtor Created 7 years, 8 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 | « chrome/browser/ui/search/instant_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_test_utils.cc
diff --git a/chrome/browser/ui/search/instant_test_utils.cc b/chrome/browser/ui/search/instant_test_utils.cc
index 7437c44afdeb3a54a8a0ffc5834bd92f048bcdc6..ac3e17fab560e40a3c3cea9aaa75dda11d7bd5ea 100644
--- a/chrome/browser/ui/search/instant_test_utils.cc
+++ b/chrome/browser/ui/search/instant_test_utils.cc
@@ -33,9 +33,10 @@ std::string WrapScript(const std::string& script) {
InstantTestModelObserver::InstantTestModelObserver(
InstantOverlayModel* model,
- SearchMode::Type desired_mode_type)
+ SearchMode::Type expected_mode_type)
: model_(model),
- desired_mode_type_(desired_mode_type) {
+ expected_mode_type_(expected_mode_type),
+ observed_mode_type_(static_cast<SearchMode::Type>(-1)) {
model_->AddObserver(this);
}
@@ -43,14 +44,16 @@ InstantTestModelObserver::~InstantTestModelObserver() {
model_->RemoveObserver(this);
}
-void InstantTestModelObserver::WaitForDesiredOverlayState() {
+bool InstantTestModelObserver::WaitForExpectedOverlayState() {
run_loop_.Run();
+ return observed_mode_type_ == expected_mode_type_;
}
void InstantTestModelObserver::OverlayStateChanged(
const InstantOverlayModel& model) {
- if (model.mode().mode == desired_mode_type_)
- run_loop_.Quit();
+ observed_mode_type_ = model.mode().mode;
+ EXPECT_EQ(expected_mode_type_, observed_mode_type_);
+ run_loop_.Quit();
}
// InstantTestBase -----------------------------------------------------------
@@ -140,12 +143,12 @@ void InstantTestBase::SetOmniboxText(const std::string& text) {
omnibox()->SetUserText(UTF8ToUTF16(text));
}
-void InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
+bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
const std::string& text) {
InstantTestModelObserver observer(
instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS);
SetOmniboxText(text);
- observer.WaitForDesiredOverlayState();
+ return observer.WaitForExpectedOverlayState();
}
void InstantTestBase::SetOmniboxTextAndWaitForSuggestion(
« no previous file with comments | « chrome/browser/ui/search/instant_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698