Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: ios/web/public/test/fakes/test_web_state_observer.h

Issue 2724953004: Test actual arguments in WebStateImplTest::ObserverTest. (Closed)
Patch Set: Rebased Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_TEST_WEB_STATE_OBSERVER_H_ 5 #ifndef IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_
6 #define IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_ 6 #define IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_
7 7
8 #include "ios/web/public/test/fakes/test_web_state_observer_util.h"
8 #include "ios/web/public/web_state/web_state_observer.h" 9 #include "ios/web/public/web_state/web_state_observer.h"
9 10
10 class GURL; 11 class GURL;
11 12
12 namespace web { 13 namespace web {
13 14
14 class WebState; 15 class WebState;
15 16
16 // Test observer to check that the WebStateObserver methods are called as 17 // Test observer to check that the WebStateObserver methods are called as
17 // expected. 18 // expected.
18 class TestWebStateObserver : public WebStateObserver { 19 class TestWebStateObserver : public WebStateObserver {
19 public: 20 public:
20 TestWebStateObserver(WebState* web_state) : WebStateObserver(web_state) {} 21 TestWebStateObserver(WebState* web_state);
22 ~TestWebStateObserver() override;
21 23
22 // Methods returning true if the corresponding WebStateObserver method has 24 // Arguments passed to |ProvisionalNavigationStarted|.
23 // been called. 25 web::TestStartProvisionalNavigationInfo* start_provisional_navigation_info() {
24 bool provisional_navigation_started_called() const { 26 return start_provisional_navigation_info_.get();
25 return provisional_navigation_started_called_; 27 }
28 // Arguments passed to |DidFinishNavigation|.
29 web::TestDidFinishNavigationInfo* did_finish_navigation_info() {
30 return did_finish_navigation_info_.get();
31 }
32 // Arguments passed to |NavigationItemCommitted|.
33 web::TestCommitNavigationInfo* commit_navigation_info() {
34 return commit_navigation_info_.get();
35 }
36 // Arguments passed to |PageLoaded|.
37 web::TestLoadPageInfo* load_page_info() { return load_page_info_.get(); }
38 // Arguments passed to |InterstitialDismissed|.
39 web::TestDismissInterstitialInfo* dismiss_interstitial_info() {
40 return dismiss_interstitial_info_.get();
41 }
42 // Arguments passed to |LoadProgressChanged|.
43 web::TestChangeLoadingProgressInfo* change_loading_progress_info() {
44 return change_loading_progress_info_.get();
45 }
46 // Arguments passed to |NavigationItemsPruned|.
47 web::TestNavigationItemsPrunedInfo* navigation_items_pruned_info() {
48 return navigation_items_pruned_info_.get();
49 }
50 // Arguments passed to |NavigationItemChanged|.
51 web::TestNavigationItemChangedInfo* navigation_item_changed_info() {
52 return navigation_item_changed_info_.get();
53 }
54 // Arguments passed to |TitleWasSet|.
55 web::TestTitleWasSetInfo* title_was_set_info() {
56 return title_was_set_info_.get();
57 }
58 // Arguments passed to |DocumentSubmitted|.
59 web::TestSubmitDocumentInfo* submit_document_info() {
60 return submit_document_info_.get();
61 }
62 // Arguments passed to |FormActivityRegistered|.
63 web::TestFormActivityInfo* form_activity_info() {
64 return form_activity_info_.get();
65 }
66 // Arguments passed to |FaviconUrlUpdated|.
67 web::TestUpdateFaviconUrlCandidatesInfo*
68 update_favicon_url_candidates_info() {
69 return update_favicon_url_candidates_info_.get();
70 }
71 // Arguments passed to |RenderProcessGone|.
72 web::TestRenderProcessGoneInfo* render_process_gone_info() {
73 return render_process_gone_info_.get();
26 }; 74 };
27 bool navigation_items_pruned_called() const { 75 // Arguments passed to |WebStateDestroyed|.
28 return navigation_items_pruned_called_; 76 web::TestWebStateDestroyedInfo* web_state_destroyed_info() {
77 return web_state_destroyed_info_.get();
78 };
79 // Arguments passed to |DidStartLoading|.
80 web::TestStopLoadingInfo* stop_loading_info() {
81 return stop_loading_info_.get();
29 } 82 }
30 bool navigation_item_changed_called() const { 83 // Arguments passed to |DidStopLoading|.
31 return navigation_item_changed_called_; 84 web::TestStartLoadingInfo* start_loading_info() {
32 } 85 return start_loading_info_.get();
33 bool navigation_item_committed_called() const {
34 return navigation_item_committed_called_;
35 }
36 bool page_loaded_called_with_success() const {
37 return page_loaded_called_with_success_;
38 }
39 bool history_state_changed_called() const {
40 return history_state_changed_called_;
41 }
42 bool did_finish_navigation_called() const {
43 return did_finish_navigation_called_;
44 }
45 bool title_was_set_called() const { return title_was_set_called_; }
46 bool web_state_destroyed_called() const {
47 return web_state_destroyed_called_;
48 } 86 }
49 87
50 private: 88 private:
51 // WebStateObserver implementation: 89 // WebStateObserver implementation:
52 void ProvisionalNavigationStarted(const GURL& url) override; 90 void ProvisionalNavigationStarted(const GURL& url) override;
91 void NavigationItemCommitted(const LoadCommittedDetails&) override;
92 void PageLoaded(PageLoadCompletionStatus load_completion_status) override;
93 void InterstitialDismissed() override;
94 void LoadProgressChanged(double progress) override;
53 void NavigationItemsPruned(size_t pruned_item_count) override; 95 void NavigationItemsPruned(size_t pruned_item_count) override;
54 void NavigationItemChanged() override; 96 void NavigationItemChanged() override;
55 void NavigationItemCommitted(const LoadCommittedDetails&) override; 97 void DidFinishNavigation(NavigationContext* context) override;
56 void DidFinishNavigation(NavigationContext* navigation_context) override;
57 void PageLoaded(PageLoadCompletionStatus load_completion_status) override;
58 void TitleWasSet() override; 98 void TitleWasSet() override;
99 void DocumentSubmitted(const std::string& form_name,
100 bool user_initiated) override;
101 void FormActivityRegistered(const std::string& form_name,
102 const std::string& field_name,
103 const std::string& type,
104 const std::string& value,
105 bool input_missing) override;
106 void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) override;
107 void RenderProcessGone() override;
59 void WebStateDestroyed() override; 108 void WebStateDestroyed() override;
109 void DidStartLoading() override;
110 void DidStopLoading() override;
60 111
61 bool provisional_navigation_started_called_ = false; 112 std::unique_ptr<web::TestStartProvisionalNavigationInfo>
62 bool navigation_items_pruned_called_ = false; 113 start_provisional_navigation_info_;
63 bool navigation_item_changed_called_ = false; 114 std::unique_ptr<web::TestCommitNavigationInfo> commit_navigation_info_;
64 bool navigation_item_committed_called_ = false; 115 std::unique_ptr<web::TestLoadPageInfo> load_page_info_;
65 bool page_loaded_called_with_success_ = false; 116 std::unique_ptr<web::TestDismissInterstitialInfo> dismiss_interstitial_info_;
66 bool history_state_changed_called_ = false; 117 std::unique_ptr<web::TestChangeLoadingProgressInfo>
67 bool did_finish_navigation_called_ = false; 118 change_loading_progress_info_;
68 bool title_was_set_called_ = false; 119 std::unique_ptr<web::TestNavigationItemsPrunedInfo>
69 bool web_state_destroyed_called_ = false; 120 navigation_items_pruned_info_;
121 std::unique_ptr<web::TestNavigationItemChangedInfo>
122 navigation_item_changed_info_;
123 std::unique_ptr<web::TestDidFinishNavigationInfo> did_finish_navigation_info_;
124 std::unique_ptr<web::TestTitleWasSetInfo> title_was_set_info_;
125 std::unique_ptr<web::TestSubmitDocumentInfo> submit_document_info_;
126 std::unique_ptr<web::TestFormActivityInfo> form_activity_info_;
127 std::unique_ptr<web::TestUpdateFaviconUrlCandidatesInfo>
128 update_favicon_url_candidates_info_;
129 std::unique_ptr<web::TestRenderProcessGoneInfo> render_process_gone_info_;
130 std::unique_ptr<web::TestWebStateDestroyedInfo> web_state_destroyed_info_;
131 std::unique_ptr<web::TestStartLoadingInfo> start_loading_info_;
132 std::unique_ptr<web::TestStopLoadingInfo> stop_loading_info_;
70 }; 133 };
71 134
72 } // namespace web 135 } // namespace web
73 136
74 #endif // IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_ 137 #endif // IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698