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

Unified Diff: ios/web/public/test/fakes/crw_test_web_state_observer.mm

Issue 2724953004: Test actual arguments in WebStateImplTest::ObserverTest. (Closed)
Patch Set: Rebased 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/public/test/fakes/crw_test_web_state_observer.mm
diff --git a/ios/web/public/test/fakes/crw_test_web_state_observer.mm b/ios/web/public/test/fakes/crw_test_web_state_observer.mm
index 2ef8ae5f94f89f8fa81adba7308537b1fbf1886a..7318b888d887830b0d8216d02651ae174b9752c5 100644
--- a/ios/web/public/test/fakes/crw_test_web_state_observer.mm
+++ b/ios/web/public/test/fakes/crw_test_web_state_observer.mm
@@ -5,6 +5,9 @@
#import "ios/web/public/test/fakes/crw_test_web_state_observer.h"
#include "base/memory/ptr_util.h"
+#include "ios/web/public/web_state/navigation_context.h"
+#include "ios/web/web_state/navigation_context_impl.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace web {
TestFormActivityInfo::TestFormActivityInfo() {}
@@ -26,8 +29,6 @@ TestUpdateFaviconUrlCandidatesInfo::~TestUpdateFaviconUrlCandidatesInfo() =
std::unique_ptr<web::TestLoadPageInfo> _loadPageInfo;
// Arguments passed to |webStateDidDismissInterstitial:|.
std::unique_ptr<web::TestDismissInterstitialInfo> _dismissInterstitialInfo;
- // Arguments passed to |webStateDidChangeHistoryState:|.
- std::unique_ptr<web::TestChangeHistoryStateInfo> _changeHistoryStateInfo;
// Arguments passed to |webState:didChangeLoadingProgress:|.
std::unique_ptr<web::TestChangeLoadingProgressInfo>
_changeLoadingProgressInfo;
@@ -72,10 +73,6 @@ TestUpdateFaviconUrlCandidatesInfo::~TestUpdateFaviconUrlCandidatesInfo() =
return _dismissInterstitialInfo.get();
}
-- (web::TestChangeHistoryStateInfo*)changeHistoryStateInfo {
- return _changeHistoryStateInfo.get();
-}
-
- (web::TestChangeLoadingProgressInfo*)changeLoadingProgressInfo {
return _changeLoadingProgressInfo.get();
}
@@ -135,7 +132,21 @@ TestUpdateFaviconUrlCandidatesInfo::~TestUpdateFaviconUrlCandidatesInfo() =
_didFinishNavigationInfo =
base::MakeUnique<web::TestDidFinishNavigationInfo>();
_didFinishNavigationInfo->web_state = webState;
- _didFinishNavigationInfo->context = navigation;
+ if (navigation->IsSamePage()) {
+ ASSERT_FALSE(navigation->IsErrorPage());
+ _didFinishNavigationInfo->context =
+ web::NavigationContextImpl::CreateSamePageNavigationContext(
+ navigation->GetWebState(), navigation->GetUrl());
+ } else if (navigation->IsErrorPage()) {
+ ASSERT_FALSE(navigation->IsSamePage());
+ _didFinishNavigationInfo->context =
+ web::NavigationContextImpl::CreateErrorPageNavigationContext(
+ navigation->GetWebState(), navigation->GetUrl());
+ } else {
+ _didFinishNavigationInfo->context =
+ web::NavigationContextImpl::CreateNavigationContext(
+ navigation->GetWebState(), navigation->GetUrl());
+ }
}
- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success {
@@ -150,11 +161,6 @@ TestUpdateFaviconUrlCandidatesInfo::~TestUpdateFaviconUrlCandidatesInfo() =
_dismissInterstitialInfo->web_state = webState;
}
-- (void)webStateDidChangeHistoryState:(web::WebState*)webState {
- _changeHistoryStateInfo = base::MakeUnique<web::TestChangeHistoryStateInfo>();
- _changeHistoryStateInfo->web_state = webState;
-}
-
- (void)webState:(web::WebState*)webState
didChangeLoadingProgress:(double)progress {
_changeLoadingProgressInfo =

Powered by Google App Engine
This is Rietveld 408576698