| Index: content/public/test/browser_test_utils.cc
|
| diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
|
| index 2a0072c65bce29a44ea4c6130ab55ed8bb26d206..5e17cb5727f336b6bf86782c1b3ba576dd69c42b 100644
|
| --- a/content/public/test/browser_test_utils.cc
|
| +++ b/content/public/test/browser_test_utils.cc
|
| @@ -16,7 +16,6 @@
|
| #include "base/macros.h"
|
| #include "base/process/kill.h"
|
| #include "base/rand_util.h"
|
| -#include "base/stl_util.h"
|
| #include "base/strings/pattern.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_piece.h"
|
| @@ -1193,14 +1192,11 @@
|
| }
|
| #endif
|
|
|
| -TitleWatcher::TitleWatcher(WebContents* web_contents)
|
| - : WebContentsObserver(web_contents) {
|
| - EXPECT_TRUE(web_contents != nullptr);
|
| -}
|
| -
|
| TitleWatcher::TitleWatcher(WebContents* web_contents,
|
| const base::string16& expected_title)
|
| - : TitleWatcher(web_contents) {
|
| + : WebContentsObserver(web_contents),
|
| + message_loop_runner_(new MessageLoopRunner) {
|
| + EXPECT_TRUE(web_contents != NULL);
|
| expected_titles_.push_back(expected_title);
|
| }
|
|
|
| @@ -1213,7 +1209,7 @@
|
|
|
| const base::string16& TitleWatcher::WaitAndGetTitle() {
|
| TestTitle();
|
| - run_loop_.Run();
|
| + message_loop_runner_->Run();
|
| return observed_title_;
|
| }
|
|
|
| @@ -1230,12 +1226,15 @@
|
| }
|
|
|
| void TitleWatcher::TestTitle() {
|
| - const base::string16& current_title = web_contents()->GetTitle();
|
| - if ((!current_title.empty() && expected_titles_.empty()) ||
|
| - base::ContainsValue(expected_titles_, current_title)) {
|
| - observed_title_ = current_title;
|
| - run_loop_.Quit();
|
| - }
|
| + std::vector<base::string16>::const_iterator it =
|
| + std::find(expected_titles_.begin(),
|
| + expected_titles_.end(),
|
| + web_contents()->GetTitle());
|
| + if (it == expected_titles_.end())
|
| + return;
|
| +
|
| + observed_title_ = *it;
|
| + message_loop_runner_->Quit();
|
| }
|
|
|
| RenderProcessHostWatcher::RenderProcessHostWatcher(
|
|
|