Index: ios/web/public/test/fakes/test_web_state_observer.h |
diff --git a/ios/web/public/test/fakes/test_web_state_observer.h b/ios/web/public/test/fakes/test_web_state_observer.h |
index f2e513280fff46d8736e1518ca859703d0c458c2..91f22da3916a03ce4060d4c3a682318cea98b5aa 100644 |
--- a/ios/web/public/test/fakes/test_web_state_observer.h |
+++ b/ios/web/public/test/fakes/test_web_state_observer.h |
@@ -5,6 +5,7 @@ |
#ifndef IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_ |
#define IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_ |
+#include "ios/web/public/test/fakes/test_web_state_observer_util.h" |
#include "ios/web/public/web_state/web_state_observer.h" |
class GURL; |
@@ -17,56 +18,118 @@ class WebState; |
// expected. |
class TestWebStateObserver : public WebStateObserver { |
public: |
- TestWebStateObserver(WebState* web_state) : WebStateObserver(web_state) {} |
+ TestWebStateObserver(WebState* web_state); |
+ ~TestWebStateObserver() override; |
- // Methods returning true if the corresponding WebStateObserver method has |
- // been called. |
- bool provisional_navigation_started_called() const { |
- return provisional_navigation_started_called_; |
- }; |
- bool navigation_items_pruned_called() const { |
- return navigation_items_pruned_called_; |
+ // Arguments passed to |ProvisionalNavigationStarted|. |
+ web::TestStartProvisionalNavigationInfo* start_provisional_navigation_info() { |
+ return start_provisional_navigation_info_.get(); |
+ } |
+ // Arguments passed to |DidFinishNavigation|. |
+ web::TestDidFinishNavigationInfo* did_finish_navigation_info() { |
+ return did_finish_navigation_info_.get(); |
+ } |
+ // Arguments passed to |NavigationItemCommitted|. |
+ web::TestCommitNavigationInfo* commit_navigation_info() { |
+ return commit_navigation_info_.get(); |
+ } |
+ // Arguments passed to |PageLoaded|. |
+ web::TestLoadPageInfo* load_page_info() { return load_page_info_.get(); } |
+ // Arguments passed to |InterstitialDismissed|. |
+ web::TestDismissInterstitialInfo* dismiss_interstitial_info() { |
+ return dismiss_interstitial_info_.get(); |
} |
- bool navigation_item_changed_called() const { |
- return navigation_item_changed_called_; |
+ // Arguments passed to |LoadProgressChanged|. |
+ web::TestChangeLoadingProgressInfo* change_loading_progress_info() { |
+ return change_loading_progress_info_.get(); |
} |
- bool navigation_item_committed_called() const { |
- return navigation_item_committed_called_; |
+ // Arguments passed to |NavigationItemsPruned|. |
+ web::TestNavigationItemsPrunedInfo* navigation_items_pruned_info() { |
+ return navigation_items_pruned_info_.get(); |
} |
- bool page_loaded_called_with_success() const { |
- return page_loaded_called_with_success_; |
+ // Arguments passed to |NavigationItemChanged|. |
+ web::TestNavigationItemChangedInfo* navigation_item_changed_info() { |
+ return navigation_item_changed_info_.get(); |
} |
- bool history_state_changed_called() const { |
- return history_state_changed_called_; |
+ // Arguments passed to |TitleWasSet|. |
+ web::TestTitleWasSetInfo* title_was_set_info() { |
+ return title_was_set_info_.get(); |
} |
- bool did_finish_navigation_called() const { |
- return did_finish_navigation_called_; |
+ // Arguments passed to |DocumentSubmitted|. |
+ web::TestSubmitDocumentInfo* submit_document_info() { |
+ return submit_document_info_.get(); |
} |
- bool title_was_set_called() const { return title_was_set_called_; } |
- bool web_state_destroyed_called() const { |
- return web_state_destroyed_called_; |
+ // Arguments passed to |FormActivityRegistered|. |
+ web::TestFormActivityInfo* form_activity_info() { |
+ return form_activity_info_.get(); |
+ } |
+ // Arguments passed to |FaviconUrlUpdated|. |
+ web::TestUpdateFaviconUrlCandidatesInfo* |
+ update_favicon_url_candidates_info() { |
+ return update_favicon_url_candidates_info_.get(); |
+ } |
+ // Arguments passed to |RenderProcessGone|. |
+ web::TestRenderProcessGoneInfo* render_process_gone_info() { |
+ return render_process_gone_info_.get(); |
+ }; |
+ // Arguments passed to |WebStateDestroyed|. |
+ web::TestWebStateDestroyedInfo* web_state_destroyed_info() { |
+ return web_state_destroyed_info_.get(); |
+ }; |
+ // Arguments passed to |DidStartLoading|. |
+ web::TestStopLoadingInfo* stop_loading_info() { |
+ return stop_loading_info_.get(); |
+ } |
+ // Arguments passed to |DidStopLoading|. |
+ web::TestStartLoadingInfo* start_loading_info() { |
+ return start_loading_info_.get(); |
} |
private: |
// WebStateObserver implementation: |
void ProvisionalNavigationStarted(const GURL& url) override; |
- void NavigationItemsPruned(size_t pruned_item_count) override; |
- void NavigationItemChanged() override; |
void NavigationItemCommitted(const LoadCommittedDetails&) override; |
- void DidFinishNavigation(NavigationContext* navigation_context) override; |
void PageLoaded(PageLoadCompletionStatus load_completion_status) override; |
+ void InterstitialDismissed() override; |
+ void LoadProgressChanged(double progress) override; |
+ void NavigationItemsPruned(size_t pruned_item_count) override; |
+ void NavigationItemChanged() override; |
+ void DidFinishNavigation(NavigationContext* context) override; |
void TitleWasSet() override; |
+ void DocumentSubmitted(const std::string& form_name, |
+ bool user_initiated) override; |
+ void FormActivityRegistered(const std::string& form_name, |
+ const std::string& field_name, |
+ const std::string& type, |
+ const std::string& value, |
+ bool input_missing) override; |
+ void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) override; |
+ void RenderProcessGone() override; |
void WebStateDestroyed() override; |
+ void DidStartLoading() override; |
+ void DidStopLoading() override; |
- bool provisional_navigation_started_called_ = false; |
- bool navigation_items_pruned_called_ = false; |
- bool navigation_item_changed_called_ = false; |
- bool navigation_item_committed_called_ = false; |
- bool page_loaded_called_with_success_ = false; |
- bool history_state_changed_called_ = false; |
- bool did_finish_navigation_called_ = false; |
- bool title_was_set_called_ = false; |
- bool web_state_destroyed_called_ = false; |
+ std::unique_ptr<web::TestStartProvisionalNavigationInfo> |
+ start_provisional_navigation_info_; |
+ std::unique_ptr<web::TestCommitNavigationInfo> commit_navigation_info_; |
+ std::unique_ptr<web::TestLoadPageInfo> load_page_info_; |
+ std::unique_ptr<web::TestDismissInterstitialInfo> dismiss_interstitial_info_; |
+ std::unique_ptr<web::TestChangeLoadingProgressInfo> |
+ change_loading_progress_info_; |
+ std::unique_ptr<web::TestNavigationItemsPrunedInfo> |
+ navigation_items_pruned_info_; |
+ std::unique_ptr<web::TestNavigationItemChangedInfo> |
+ navigation_item_changed_info_; |
+ std::unique_ptr<web::TestDidFinishNavigationInfo> did_finish_navigation_info_; |
+ std::unique_ptr<web::TestTitleWasSetInfo> title_was_set_info_; |
+ std::unique_ptr<web::TestSubmitDocumentInfo> submit_document_info_; |
+ std::unique_ptr<web::TestFormActivityInfo> form_activity_info_; |
+ std::unique_ptr<web::TestUpdateFaviconUrlCandidatesInfo> |
+ update_favicon_url_candidates_info_; |
+ std::unique_ptr<web::TestRenderProcessGoneInfo> render_process_gone_info_; |
+ std::unique_ptr<web::TestWebStateDestroyedInfo> web_state_destroyed_info_; |
+ std::unique_ptr<web::TestStartLoadingInfo> start_loading_info_; |
+ std::unique_ptr<web::TestStopLoadingInfo> stop_loading_info_; |
}; |
} // namespace web |