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