OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_WEB_TEST_WEB_INT_TEST_H_ | 5 #ifndef IOS_WEB_TEST_WEB_INT_TEST_H_ |
6 #define IOS_WEB_TEST_WEB_INT_TEST_H_ | 6 #define IOS_WEB_TEST_WEB_INT_TEST_H_ |
7 | 7 |
8 #import <WebKit/WebKit.h> | 8 #import <WebKit/WebKit.h> |
9 | 9 |
10 #import "base/ios/block_types.h" | 10 #import "base/ios/block_types.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // WebTest methods. | 28 // WebTest methods. |
29 void SetUp() override; | 29 void SetUp() override; |
30 void TearDown() override; | 30 void TearDown() override; |
31 | 31 |
32 // The WebState and NavigationManager used by this test fixture. | 32 // The WebState and NavigationManager used by this test fixture. |
33 WebState* web_state() { return web_state_.get(); } | 33 WebState* web_state() { return web_state_.get(); } |
34 NavigationManager* navigation_manager() { | 34 NavigationManager* navigation_manager() { |
35 return web_state()->GetNavigationManager(); | 35 return web_state()->GetNavigationManager(); |
36 } | 36 } |
37 | 37 |
| 38 // Returns the last committed NavigationItem in |navigation_manager|. |
| 39 NavigationItem* GetLastCommittedItem() { |
| 40 return navigation_manager()->GetLastCommittedItem(); |
| 41 } |
| 42 |
38 // Synchronously executes |script| on |web_state|'s JS injection receiver and | 43 // Synchronously executes |script| on |web_state|'s JS injection receiver and |
39 // returns the result. | 44 // returns the result. |
40 id ExecuteJavaScript(NSString* script); | 45 id ExecuteJavaScript(NSString* script); |
41 | 46 |
42 // Executes |block| and waits until |url| is successfully loaded in | 47 // Executes |block| and waits until |url| is successfully loaded in |
43 // |web_state_|. | 48 // |web_state_|. |
44 void ExecuteBlockAndWaitForLoad(const GURL& url, ProceduralBlock block); | 49 void ExecuteBlockAndWaitForLoad(const GURL& url, ProceduralBlock block); |
45 | 50 |
46 // Navigates |web_state_| to |url| and waits for the page to be loaded. | 51 // Navigates |web_state_| to |url| and waits for the page to be loaded. |
47 void LoadUrl(const GURL& url); | 52 void LoadUrl(const GURL& url); |
(...skipping 13 matching lines...) Expand all Loading... |
61 private: | 66 private: |
62 // WebState used to load pages. | 67 // WebState used to load pages. |
63 std::unique_ptr<WebState> web_state_; | 68 std::unique_ptr<WebState> web_state_; |
64 // WebStateObserver used to wait for page loads. | 69 // WebStateObserver used to wait for page loads. |
65 std::unique_ptr<IntTestWebStateObserver> observer_; | 70 std::unique_ptr<IntTestWebStateObserver> observer_; |
66 }; | 71 }; |
67 | 72 |
68 } // namespace web | 73 } // namespace web |
69 | 74 |
70 #endif // IOS_WEB_TEST_WEB_INT_TEST_H_ | 75 #endif // IOS_WEB_TEST_WEB_INT_TEST_H_ |
OLD | NEW |