| Index: chrome/test/base/ui_test_utils.cc
|
| ===================================================================
|
| --- chrome/test/base/ui_test_utils.cc (revision 94917)
|
| +++ chrome/test/base/ui_test_utils.cc (working copy)
|
| @@ -900,10 +900,13 @@
|
| }
|
|
|
| TitleWatcher::TitleWatcher(TabContents* tab_contents,
|
| - const string16& expected_title)
|
| + const string16& expected_title,
|
| + const string16& failure_title)
|
| : expected_tab_(tab_contents),
|
| expected_title_(expected_title),
|
| - title_observed_(false),
|
| + failure_title_(failure_title),
|
| + expected_title_observed_(false),
|
| + failure_title_observed_(false),
|
| quit_loop_on_observation_(false) {
|
| EXPECT_TRUE(tab_contents != NULL);
|
| notification_registrar_.Add(this,
|
| @@ -915,11 +918,13 @@
|
| }
|
|
|
| bool TitleWatcher::Wait() {
|
| - if (title_observed_)
|
| + if (expected_title_observed_)
|
| return true;
|
| + if (failure_title_observed_)
|
| + return false;
|
| quit_loop_on_observation_ = true;
|
| ui_test_utils::RunMessageLoop();
|
| - return title_observed_;
|
| + return expected_title_observed_ && !failure_title_observed_;
|
| }
|
|
|
| void TitleWatcher::Observe(int type,
|
| @@ -930,10 +935,15 @@
|
|
|
| TabContents* source_contents = Source<TabContents>(source).ptr();
|
| ASSERT_EQ(expected_tab_, source_contents);
|
| - if (source_contents->GetTitle() != expected_title_)
|
| + if (source_contents->GetTitle() == expected_title_) {
|
| + expected_title_observed_ = true;
|
| + } else if (failure_title_.length() > 0 &&
|
| + source_contents->GetTitle() == failure_title_) {
|
| + failure_title_observed_ = true;
|
| + } else {
|
| return;
|
| + }
|
|
|
| - title_observed_ = true;
|
| if (quit_loop_on_observation_)
|
| MessageLoopForUI::current()->Quit();
|
| }
|
|
|