OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PUBLIC_TEST_FAKES_CRW_TEST_WEB_STATE_OBSERVER_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_FAKES_CRW_TEST_WEB_STATE_OBSERVER_H_ |
6 #define IOS_WEB_PUBLIC_TEST_FAKES_CRW_TEST_WEB_STATE_OBSERVER_H_ | 6 #define IOS_WEB_PUBLIC_TEST_FAKES_CRW_TEST_WEB_STATE_OBSERVER_H_ |
7 | 7 |
8 #include "ios/web/public/favicon_url.h" | 8 #include "ios/web/public/test/fakes/test_web_state_observer_util.h" |
9 #include "ios/web/public/load_committed_details.h" | |
10 #import "ios/web/public/web_state/web_state_observer_bridge.h" | 9 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
11 | 10 |
12 namespace web { | |
13 | |
14 class NavigationContext; | |
15 class WebState; | |
16 | |
17 // Arguments passed to |webState:didStartProvisionalNavigationForURL:|. | |
18 struct TestStartProvisionalNavigationInfo { | |
19 WebState* web_state; | |
20 GURL url; | |
21 }; | |
22 | |
23 // Arguments passed to |webState:didFinishNavigation:|. | |
24 struct TestDidFinishNavigationInfo { | |
25 WebState* web_state; | |
26 web::NavigationContext* context; | |
27 }; | |
28 | |
29 // Arguments passed to |webState:didCommitNavigationWithDetails:|. | |
30 struct TestCommitNavigationInfo { | |
31 WebState* web_state; | |
32 LoadCommittedDetails load_details; | |
33 }; | |
34 | |
35 // Arguments passed to |webState:didLoadPageWithSuccess:|. | |
36 struct TestLoadPageInfo { | |
37 WebState* web_state; | |
38 BOOL success; | |
39 }; | |
40 | |
41 // Arguments passed to |webStateDidDismissInterstitial:|. | |
42 struct TestDismissInterstitialInfo { | |
43 WebState* web_state; | |
44 }; | |
45 | |
46 // Arguments passed to |webStateDidChangeHistoryState:|. | |
47 struct TestChangeHistoryStateInfo { | |
48 WebState* web_state; | |
49 }; | |
50 | |
51 // Arguments passed to |webState:didChangeLoadingProgress:|. | |
52 struct TestChangeLoadingProgressInfo { | |
53 WebState* web_state; | |
54 double progress; | |
55 }; | |
56 | |
57 // Arguments passed to |webStateDidChangeTitle:|. | |
58 struct TestTitleWasSetInfo { | |
59 WebState* web_state; | |
60 }; | |
61 | |
62 // Arguments passed to |webState:didSubmitDocumentWithFormNamed:userInitiated:|. | |
63 struct TestSubmitDocumentInfo { | |
64 WebState* web_state; | |
65 std::string form_name; | |
66 BOOL user_initiated; | |
67 }; | |
68 | |
69 // Arguments passed to | |
70 // |webState:didRegisterFormActivityWithFormNamed:fieldName:type:value:|. | |
71 struct TestFormActivityInfo { | |
72 TestFormActivityInfo(); | |
73 ~TestFormActivityInfo(); | |
74 WebState* web_state; | |
75 std::string form_name; | |
76 std::string field_name; | |
77 std::string type; | |
78 std::string value; | |
79 bool input_missing; | |
80 }; | |
81 | |
82 // Arguments passed to |webState:didUpdateFaviconURLCandidates|. | |
83 struct TestUpdateFaviconUrlCandidatesInfo { | |
84 TestUpdateFaviconUrlCandidatesInfo(); | |
85 ~TestUpdateFaviconUrlCandidatesInfo(); | |
86 WebState* web_state; | |
87 std::vector<web::FaviconURL> candidates; | |
88 }; | |
89 | |
90 // Arguments passed to |webState:renderProcessGoneForWebState:|. | |
91 struct TestRenderProcessGoneInfo { | |
92 WebState* web_state; | |
93 }; | |
94 | |
95 // Arguments passed to |webStateDestroyed:|. | |
96 struct TestWebStateDestroyedInfo { | |
97 WebState* web_state; | |
98 }; | |
99 | |
100 // Arguments passed to |webStateDidStopLoading:|. | |
101 struct TestStopLoadingInfo { | |
102 WebState* web_state; | |
103 }; | |
104 | |
105 // Arguments passed to |webStateDidStartLoading:|. | |
106 struct TestStartLoadingInfo { | |
107 WebState* web_state; | |
108 }; | |
109 | |
110 } // namespace web | |
111 | |
112 // Test implementation of CRWWebStateObserver protocol. | 11 // Test implementation of CRWWebStateObserver protocol. |
113 @interface CRWTestWebStateObserver : NSObject<CRWWebStateObserver> | 12 @interface CRWTestWebStateObserver : NSObject<CRWWebStateObserver> |
114 | 13 |
115 // Arguments passed to |webState:didStartProvisionalNavigationForURL:|. | 14 // Arguments passed to |webState:didStartProvisionalNavigationForURL:|. |
116 @property(nonatomic, readonly) | 15 @property(nonatomic, readonly) |
117 web::TestStartProvisionalNavigationInfo* startProvisionalNavigationInfo; | 16 web::TestStartProvisionalNavigationInfo* startProvisionalNavigationInfo; |
118 // Arguments passed to |webState:didFinishNavigation:|. | 17 // Arguments passed to |webState:didFinishNavigation:|. |
119 @property(nonatomic, readonly) | 18 @property(nonatomic, readonly) |
120 web::TestDidFinishNavigationInfo* didFinishNavigationInfo; | 19 web::TestDidFinishNavigationInfo* didFinishNavigationInfo; |
121 // Arguments passed to |webState:didCommitNavigationWithDetails:|. | 20 // Arguments passed to |webState:didCommitNavigationWithDetails:|. |
122 @property(nonatomic, readonly) | 21 @property(nonatomic, readonly) |
123 web::TestCommitNavigationInfo* commitNavigationInfo; | 22 web::TestCommitNavigationInfo* commitNavigationInfo; |
124 // Arguments passed to |webState:didLoadPageWithSuccess:|. | 23 // Arguments passed to |webState:didLoadPageWithSuccess:|. |
125 @property(nonatomic, readonly) web::TestLoadPageInfo* loadPageInfo; | 24 @property(nonatomic, readonly) web::TestLoadPageInfo* loadPageInfo; |
126 // Arguments passed to |webStateDidDismissInterstitial:|. | 25 // Arguments passed to |webStateDidDismissInterstitial:|. |
127 @property(nonatomic, readonly) | 26 @property(nonatomic, readonly) |
128 web::TestDismissInterstitialInfo* dismissInterstitialInfo; | 27 web::TestDismissInterstitialInfo* dismissInterstitialInfo; |
129 // Arguments passed to |webStateDidChangeHistoryState:|. | |
130 @property(nonatomic, readonly) | |
131 web::TestChangeHistoryStateInfo* changeHistoryStateInfo; | |
132 // Arguments passed to |webState:didChangeLoadingProgress:|. | 28 // Arguments passed to |webState:didChangeLoadingProgress:|. |
133 @property(nonatomic, readonly) | 29 @property(nonatomic, readonly) |
134 web::TestChangeLoadingProgressInfo* changeLoadingProgressInfo; | 30 web::TestChangeLoadingProgressInfo* changeLoadingProgressInfo; |
135 // Arguments passed to |webStateDidChangeTitle:|. | 31 // Arguments passed to |webStateDidChangeTitle:|. |
136 @property(nonatomic, readonly) web::TestTitleWasSetInfo* titleWasSetInfo; | 32 @property(nonatomic, readonly) web::TestTitleWasSetInfo* titleWasSetInfo; |
137 // Arguments passed to |webState:didSubmitDocumentWithFormNamed:userInitiated:|. | 33 // Arguments passed to |webState:didSubmitDocumentWithFormNamed:userInitiated:|. |
138 @property(nonatomic, readonly) web::TestSubmitDocumentInfo* submitDocumentInfo; | 34 @property(nonatomic, readonly) web::TestSubmitDocumentInfo* submitDocumentInfo; |
139 // Arguments passed to | 35 // Arguments passed to |
140 // |webState:didRegisterFormActivityWithFormNamed:fieldName:type:value:|. | 36 // |webState:didRegisterFormActivityWithFormNamed:fieldName:type:value:|. |
141 @property(nonatomic, readonly) web::TestFormActivityInfo* formActivityInfo; | 37 @property(nonatomic, readonly) web::TestFormActivityInfo* formActivityInfo; |
142 // Arguments passed to |webState:didUpdateFaviconURLCandidates|. | 38 // Arguments passed to |webState:didUpdateFaviconURLCandidates|. |
143 @property(nonatomic, readonly) | 39 @property(nonatomic, readonly) |
144 web::TestUpdateFaviconUrlCandidatesInfo* updateFaviconUrlCandidatesInfo; | 40 web::TestUpdateFaviconUrlCandidatesInfo* updateFaviconUrlCandidatesInfo; |
145 // Arguments passed to |webState:renderProcessGoneForWebState:|. | 41 // Arguments passed to |webState:renderProcessGoneForWebState:|. |
146 @property(nonatomic, readonly) | 42 @property(nonatomic, readonly) |
147 web::TestRenderProcessGoneInfo* renderProcessGoneInfo; | 43 web::TestRenderProcessGoneInfo* renderProcessGoneInfo; |
148 // Arguments passed to |webStateDestroyed:|. | 44 // Arguments passed to |webStateDestroyed:|. |
149 @property(nonatomic, readonly) | 45 @property(nonatomic, readonly) |
150 web::TestWebStateDestroyedInfo* webStateDestroyedInfo; | 46 web::TestWebStateDestroyedInfo* webStateDestroyedInfo; |
151 // Arguments passed to |webStateDidStopLoading:|. | 47 // Arguments passed to |webStateDidStopLoading:|. |
152 @property(nonatomic, readonly) web::TestStopLoadingInfo* stopLoadingInfo; | 48 @property(nonatomic, readonly) web::TestStopLoadingInfo* stopLoadingInfo; |
153 // Arguments passed to |webStateDidStartLoading:|. | 49 // Arguments passed to |webStateDidStartLoading:|. |
154 @property(nonatomic, readonly) web::TestStartLoadingInfo* startLoadingInfo; | 50 @property(nonatomic, readonly) web::TestStartLoadingInfo* startLoadingInfo; |
155 | 51 |
156 @end | 52 @end |
157 | 53 |
158 #endif // IOS_WEB_PUBLIC_TEST_FAKES_CRW_TEST_WEB_STATE_OBSERVER_H_ | 54 #endif // IOS_WEB_PUBLIC_TEST_FAKES_CRW_TEST_WEB_STATE_OBSERVER_H_ |
OLD | NEW |