| Index: chrome/test/base/ui_test_utils.cc
|
| ===================================================================
|
| --- chrome/test/base/ui_test_utils.cc (revision 147602)
|
| +++ chrome/test/base/ui_test_utils.cc (working copy)
|
| @@ -979,73 +979,6 @@
|
| content::WindowedNotificationObserver::Observe(type, source, details);
|
| }
|
|
|
| -TitleWatcher::TitleWatcher(WebContents* web_contents,
|
| - const string16& expected_title)
|
| - : web_contents_(web_contents),
|
| - expected_title_observed_(false),
|
| - quit_loop_on_observation_(false) {
|
| - EXPECT_TRUE(web_contents != NULL);
|
| - expected_titles_.push_back(expected_title);
|
| - notification_registrar_.Add(this,
|
| - content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
|
| - content::Source<WebContents>(web_contents));
|
| -
|
| - // When navigating through the history, the restored NavigationEntry's title
|
| - // will be used. If the entry ends up having the same title after we return
|
| - // to it, as will usually be the case, the
|
| - // NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED will then be suppressed, since the
|
| - // NavigationEntry's title hasn't changed.
|
| - notification_registrar_.Add(
|
| - this,
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - content::Source<NavigationController>(&web_contents->GetController()));
|
| -}
|
| -
|
| -void TitleWatcher::AlsoWaitForTitle(const string16& expected_title) {
|
| - expected_titles_.push_back(expected_title);
|
| -}
|
| -
|
| -TitleWatcher::~TitleWatcher() {
|
| -}
|
| -
|
| -const string16& TitleWatcher::WaitAndGetTitle() {
|
| - if (expected_title_observed_)
|
| - return observed_title_;
|
| - quit_loop_on_observation_ = true;
|
| - message_loop_runner_ = new content::MessageLoopRunner;
|
| - message_loop_runner_->Run();
|
| - return observed_title_;
|
| -}
|
| -
|
| -void TitleWatcher::Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - if (type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) {
|
| - WebContents* source_contents = content::Source<WebContents>(source).ptr();
|
| - ASSERT_EQ(web_contents_, source_contents);
|
| - } else if (type == content::NOTIFICATION_LOAD_STOP) {
|
| - NavigationController* controller =
|
| - content::Source<NavigationController>(source).ptr();
|
| - ASSERT_EQ(&web_contents_->GetController(), controller);
|
| - } else {
|
| - FAIL() << "Unexpected notification received.";
|
| - }
|
| -
|
| - std::vector<string16>::const_iterator it =
|
| - std::find(expected_titles_.begin(),
|
| - expected_titles_.end(),
|
| - web_contents_->GetTitle());
|
| - if (it == expected_titles_.end())
|
| - return;
|
| - observed_title_ = *it;
|
| - expected_title_observed_ = true;
|
| - if (quit_loop_on_observation_) {
|
| - // Only call Quit once, on first Observe:
|
| - quit_loop_on_observation_ = false;
|
| - message_loop_runner_->Quit();
|
| - }
|
| -}
|
| -
|
| BrowserAddedObserver::BrowserAddedObserver()
|
| : notification_observer_(
|
| chrome::NOTIFICATION_BROWSER_OPENED,
|
|
|