Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ | 5 #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
| 6 #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ | 6 #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents_observer.h" | |
| 9 | |
| 8 // A collections of functions designed for use with content_shell based browser | 10 // A collections of functions designed for use with content_shell based browser |
| 9 // tests internal to the content/ module. | 11 // tests internal to the content/ module. |
| 10 // Note: If a function here also works with browser_tests, it should be in | 12 // Note: If a function here also works with browser_tests, it should be in |
| 11 // the content public API. | 13 // the content public API. |
| 12 | 14 |
| 13 class GURL; | 15 class GURL; |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 | 18 |
| 17 class FrameTreeNode; | 19 class FrameTreeNode; |
| 18 | 20 |
| 21 // A helper class for making sure that a navigation succeeded/failed. | |
| 22 class TestNavigationWebContentsObserver : public WebContentsObserver { | |
| 23 public: | |
| 24 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
| |
| 25 ~TestNavigationWebContentsObserver(); | |
| 26 | |
| 27 void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host, | |
| 28 const GURL& validated_url, | |
| 29 bool is_error_page, | |
| 30 bool is_iframe_srcdoc) override; | |
| 31 void DidFailProvisionalLoad(RenderFrameHost* render_frame_host, | |
| 32 const GURL& validated_url, | |
| 33 int error_code, | |
| 34 const base::string16& error_description) override; | |
| 35 void DidCommitProvisionalLoadForFrame( | |
| 36 RenderFrameHost* render_frame_host, | |
| 37 const GURL& url, | |
| 38 ui::PageTransition transition_type) override; | |
| 39 | |
| 40 const GURL& navigation_url() const { return navigation_url_; } | |
| 41 | |
| 42 int navigation_succeeded() const { return navigation_succeeded_; } | |
| 43 | |
| 44 private: | |
| 45 GURL navigation_url_; | |
| 46 bool navigation_succeeded_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(TestNavigationWebContentsObserver); | |
| 49 }; | |
| 50 | |
| 19 // Navigates the frame represented by |node| to |url|, blocking until the | 51 // Navigates the frame represented by |node| to |url|, blocking until the |
| 20 // navigation finishes. | 52 // navigation finishes. |
| 21 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); | 53 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); |
| 22 | 54 |
| 23 } // namespace content | 55 } // namespace content |
| 24 | 56 |
| 25 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ | 57 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
| OLD | NEW |