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

Unified Diff: ios/web/web_state/web_state_impl_unittest.mm

Issue 2710913006: Removed -[CRWWebDelegate webController:titleDidChange:]. (Closed)
Patch Set: iOS9 fix Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/web_state_impl_unittest.mm
diff --git a/ios/web/web_state/web_state_impl_unittest.mm b/ios/web/web_state/web_state_impl_unittest.mm
index 992132f9f2dbc2eb5afb9ca6c315292d65e3df37..4b9ab13103e353cb90e11b13a32a66b9da381779 100644
--- a/ios/web/web_state/web_state_impl_unittest.mm
+++ b/ios/web/web_state/web_state_impl_unittest.mm
@@ -130,6 +130,7 @@ class TestWebStateObserver : public WebStateObserver {
url_hash_changed_called_(false),
history_state_changed_called_(false),
did_finish_navigation_called_(false),
+ title_was_set_called_(false),
web_state_destroyed_called_(false) {}
// Methods returning true if the corresponding WebStateObserver method has
@@ -156,6 +157,7 @@ class TestWebStateObserver : public WebStateObserver {
bool did_finish_navigation_called() const {
return did_finish_navigation_called_;
}
+ bool title_was_set_called() const { return title_was_set_called_; }
bool web_state_destroyed_called() const {
return web_state_destroyed_called_;
}
@@ -184,6 +186,7 @@ class TestWebStateObserver : public WebStateObserver {
}
void UrlHashChanged() override { url_hash_changed_called_ = true; }
void HistoryStateChanged() override { history_state_changed_called_ = true; }
+ void TitleWasSet() override { title_was_set_called_ = true; }
void WebStateDestroyed() override {
EXPECT_TRUE(web_state()->IsBeingDestroyed());
web_state_destroyed_called_ = true;
@@ -198,6 +201,7 @@ class TestWebStateObserver : public WebStateObserver {
bool url_hash_changed_called_;
bool history_state_changed_called_;
bool did_finish_navigation_called_;
+ bool title_was_set_called_;
bool web_state_destroyed_called_;
};
@@ -414,6 +418,11 @@ TEST_F(WebStateTest, ObserverTest) {
web_state_->OnErrorPageNavigation(GURL("http://test"));
EXPECT_TRUE(observer->did_finish_navigation_called());
+ // Test that OnTitleChanged() is called.
+ EXPECT_FALSE(observer->title_was_set_called());
+ web_state_->OnTitleChanged();
+ EXPECT_TRUE(observer->title_was_set_called());
+
// Test that WebStateDestroyed() is called.
EXPECT_FALSE(observer->web_state_destroyed_called());
web_state_.reset();

Powered by Google App Engine
This is Rietveld 408576698