Index: content/test/content_browser_test_utils_internal.h |
diff --git a/content/test/content_browser_test_utils_internal.h b/content/test/content_browser_test_utils_internal.h |
index a27aea58e881f428a30480d934178dc0cc0030b4..4e1d481213643e45ce384cc823aae2adf2156996 100644 |
--- a/content/test/content_browser_test_utils_internal.h |
+++ b/content/test/content_browser_test_utils_internal.h |
@@ -5,6 +5,8 @@ |
#ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
#define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
+#include "content/public/browser/web_contents_observer.h" |
+ |
// A collections of functions designed for use with content_shell based browser |
// tests internal to the content/ module. |
// Note: If a function here also works with browser_tests, it should be in |
@@ -16,6 +18,36 @@ namespace content { |
class FrameTreeNode; |
+// A helper class for making sure that a navigation succeeded/failed. |
+class TestNavigationWebContentsObserver : public WebContentsObserver { |
+ public: |
+ explicit TestNavigationWebContentsObserver(WebContents* web_contents); |
nasko
2014/11/24 23:15:00
I wonder if it is useful to fold this functionalit
clamy
2014/11/26 12:47:43
I think it would make sense. Especially as having
|
+ ~TestNavigationWebContentsObserver(); |
+ |
+ void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host, |
+ const GURL& validated_url, |
+ bool is_error_page, |
+ bool is_iframe_srcdoc) override; |
+ void DidFailProvisionalLoad(RenderFrameHost* render_frame_host, |
+ const GURL& validated_url, |
+ int error_code, |
+ const base::string16& error_description) override; |
+ void DidCommitProvisionalLoadForFrame( |
+ RenderFrameHost* render_frame_host, |
+ const GURL& url, |
+ ui::PageTransition transition_type) override; |
+ |
+ const GURL& navigation_url() const { return navigation_url_; } |
+ |
+ int navigation_succeeded() const { return navigation_succeeded_; } |
+ |
+ private: |
+ GURL navigation_url_; |
+ bool navigation_succeeded_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestNavigationWebContentsObserver); |
+}; |
+ |
// Navigates the frame represented by |node| to |url|, blocking until the |
// navigation finishes. |
void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); |