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

Unified Diff: chrome/test/base/web_ui_browser_test.cc

Issue 365513002: Port identity_internals to mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT for commit Created 6 years, 5 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/test/base/web_ui_browser_test.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/web_ui_browser_test.cc
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc
index cf9a2aa645a14ffbcda253429ef53783c261e7e0..c82c1d04efde6cd1e439f69a750b0ac317c0945c 100644
--- a/chrome/test/base/web_ui_browser_test.cc
+++ b/chrome/test/base/web_ui_browser_test.cc
@@ -9,6 +9,7 @@
#include "base/lazy_instance.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/values.h"
@@ -82,6 +83,35 @@ class WebUIJsInjectionReadyObserver : public content::WebContentsObserver {
std::string preload_test_name_;
};
+class WebUIMainObserver : public content::WebContentsObserver {
+ public:
+ explicit WebUIMainObserver(content::WebContents* web_contents)
+ : content::WebContentsObserver(web_contents),
+ message_loop_runner_(new content::MessageLoopRunner),
+ has_fired_(false) {
+ }
+
+ void Wait() {
+ if (has_fired_)
+ return;
+
+ message_loop_runner_->Run();
+ }
+
+ virtual void DidRunWebUIMojoMain() OVERRIDE {
+ has_fired_ = true;
+ message_loop_runner_->Quit();
+ }
+
+ private:
+ // The MessageLoopRunner used to spin the message loop.
+ scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
+
+ bool has_fired_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebUIMainObserver);
+};
+
} // namespace
WebUIBrowserTest::~WebUIBrowserTest() {
@@ -220,6 +250,14 @@ void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) {
navigation_observer.Wait();
}
+void WebUIBrowserTest::BrowsePreloadAndWaitForMain(const GURL& browse_to) {
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ WebUIMainObserver webui_main_observer(web_contents);
+ BrowsePreload(browse_to);
+ webui_main_observer.Wait();
+}
+
#if defined(ENABLE_FULL_PRINTING)
// This custom ContentBrowserClient is used to get notified when a WebContents
« no previous file with comments | « chrome/test/base/web_ui_browser_test.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698