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

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

Issue 2698413004: Implemented WebStateObserver::DidFinishNavigation(NavigationHandle*). (Closed)
Patch Set: Addressed review comments 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
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/navigation_context_impl_unittest.mm
diff --git a/ios/web/web_state/navigation_context_impl_unittest.mm b/ios/web/web_state/navigation_context_impl_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..b209afcc2fcd5d834c20fc1b2ad9a9cce7d6c152
--- /dev/null
+++ b/ios/web/web_state/navigation_context_impl_unittest.mm
@@ -0,0 +1,59 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/web/web_state/navigation_context_impl.h"
+
+#import "ios/web/public/test/fakes/test_web_state.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+namespace web {
+
+// Test fixture for NavigationContextImplTest testing.
+class NavigationContextImplTest : public PlatformTest {
+ protected:
+ NavigationContextImplTest() : url_("https://chromium.test") {}
+
+ TestWebState web_state_;
+ GURL url_;
+};
+
+// Tests CreateNavigationContext factory method.
+TEST_F(NavigationContextImplTest, NavigationContext) {
+ std::unique_ptr<NavigationContext> context =
+ NavigationContextImpl::CreateNavigationContext(&web_state_, url_);
+ ASSERT_TRUE(context);
+
+ EXPECT_EQ(&web_state_, context->GetWebState());
+ EXPECT_EQ(url_, context->GetUrl());
+ EXPECT_FALSE(context->IsSamePage());
+ EXPECT_FALSE(context->IsErrorPage());
+}
+
+// Tests CreateSamePageNavigationContext factory method.
+TEST_F(NavigationContextImplTest, SamePageNavigationContext) {
+ std::unique_ptr<NavigationContext> context =
+ NavigationContextImpl::CreateSamePageNavigationContext(&web_state_, url_);
+ ASSERT_TRUE(context);
+
+ EXPECT_EQ(&web_state_, context->GetWebState());
+ EXPECT_EQ(url_, context->GetUrl());
+ EXPECT_TRUE(context->IsSamePage());
+ EXPECT_FALSE(context->IsErrorPage());
+}
+
+// Tests CreateErrorPageNavigationContext factory method.
+TEST_F(NavigationContextImplTest, ErrorPageNavigationContext) {
+ std::unique_ptr<NavigationContext> context =
+ NavigationContextImpl::CreateErrorPageNavigationContext(&web_state_,
+ url_);
+ ASSERT_TRUE(context);
+
+ EXPECT_EQ(&web_state_, context->GetWebState());
+ EXPECT_EQ(url_, context->GetUrl());
+ EXPECT_FALSE(context->IsSamePage());
+ EXPECT_TRUE(context->IsErrorPage());
+}
+
+} // namespace web
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698