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

Unified Diff: content/public/test/browser_test_utils.h

Issue 2601843002: Convert more test helpers to base::RunLoop, fix page title checks. (Closed)
Patch Set: Remove unneeded call. Created 3 years, 11 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
Index: content/public/test/browser_test_utils.h
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h
index e39416c789bd79e3bded26d7690201a40d3915a4..7434184877101e15358ca46e9fd40a11be94532b 100644
--- a/content/public/test/browser_test_utils.h
+++ b/content/public/test/browser_test_utils.h
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
+#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "build/build_config.h"
#include "cc/output/compositor_frame.h"
@@ -346,11 +347,16 @@ void WaitForGuestSurfaceReady(content::WebContents* web_contents);
#endif
-// Watches title changes on a WebContents, blocking until an expected title is
-// set.
+// Watches title changes on a WebContents, blocking until a title is set.
+// Can wait unitl a specific expected title appears.
class TitleWatcher : public WebContentsObserver {
public:
// |web_contents| must be non-NULL and needs to stay alive for the
+ // entire lifetime of |this|. Will wait for any (non-empty) title unless
+ // |AlsoWaitForTitle| is called before waiting.
+ explicit TitleWatcher(WebContents* web_contents);
+
+ // |web_contents| must be non-NULL and needs to stay alive for the
// entire lifetime of |this|. |expected_title| is the title that |this|
// will wait for.
TitleWatcher(WebContents* web_contents,
@@ -373,7 +379,7 @@ class TitleWatcher : public WebContentsObserver {
void TestTitle();
std::vector<base::string16> expected_titles_;
- scoped_refptr<MessageLoopRunner> message_loop_runner_;
+ base::RunLoop run_loop_;
// The most recently observed expected title, if any.
base::string16 observed_title_;

Powered by Google App Engine
This is Rietveld 408576698