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

Side by Side Diff: ios/web/web_state/navigation_context_impl_unittest.mm

Issue 2734293002: s/IsSamePage/IsSameDocument for NavigationContext. (Closed)
Patch Set: 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 #include "ios/web/web_state/navigation_context_impl.h" 5 #include "ios/web/web_state/navigation_context_impl.h"
6 6
7 #import "ios/web/public/test/fakes/test_web_state.h" 7 #import "ios/web/public/test/fakes/test_web_state.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/platform_test.h" 9 #include "testing/platform_test.h"
10 10
11 namespace web { 11 namespace web {
12 12
13 // Test fixture for NavigationContextImplTest testing. 13 // Test fixture for NavigationContextImplTest testing.
14 class NavigationContextImplTest : public PlatformTest { 14 class NavigationContextImplTest : public PlatformTest {
15 protected: 15 protected:
16 NavigationContextImplTest() : url_("https://chromium.test") {} 16 NavigationContextImplTest() : url_("https://chromium.test") {}
17 17
18 TestWebState web_state_; 18 TestWebState web_state_;
19 GURL url_; 19 GURL url_;
20 }; 20 };
21 21
22 // Tests CreateNavigationContext factory method. 22 // Tests CreateNavigationContext factory method.
23 TEST_F(NavigationContextImplTest, NavigationContext) { 23 TEST_F(NavigationContextImplTest, NavigationContext) {
24 std::unique_ptr<NavigationContext> context = 24 std::unique_ptr<NavigationContext> context =
25 NavigationContextImpl::CreateNavigationContext(&web_state_, url_); 25 NavigationContextImpl::CreateNavigationContext(&web_state_, url_);
26 ASSERT_TRUE(context); 26 ASSERT_TRUE(context);
27 27
28 EXPECT_EQ(&web_state_, context->GetWebState()); 28 EXPECT_EQ(&web_state_, context->GetWebState());
29 EXPECT_EQ(url_, context->GetUrl()); 29 EXPECT_EQ(url_, context->GetUrl());
30 EXPECT_FALSE(context->IsSamePage()); 30 EXPECT_FALSE(context->IsSameDocument());
31 EXPECT_FALSE(context->IsErrorPage()); 31 EXPECT_FALSE(context->IsErrorPage());
32 } 32 }
33 33
34 // Tests CreateSamePageNavigationContext factory method. 34 // Tests CreateSamePageNavigationContext factory method.
35 TEST_F(NavigationContextImplTest, SamePageNavigationContext) { 35 TEST_F(NavigationContextImplTest, SamePageNavigationContext) {
36 std::unique_ptr<NavigationContext> context = 36 std::unique_ptr<NavigationContext> context =
37 NavigationContextImpl::CreateSamePageNavigationContext(&web_state_, url_); 37 NavigationContextImpl::CreateSamePageNavigationContext(&web_state_, url_);
38 ASSERT_TRUE(context); 38 ASSERT_TRUE(context);
39 39
40 EXPECT_EQ(&web_state_, context->GetWebState()); 40 EXPECT_EQ(&web_state_, context->GetWebState());
41 EXPECT_EQ(url_, context->GetUrl()); 41 EXPECT_EQ(url_, context->GetUrl());
42 EXPECT_TRUE(context->IsSamePage()); 42 EXPECT_TRUE(context->IsSameDocument());
43 EXPECT_FALSE(context->IsErrorPage()); 43 EXPECT_FALSE(context->IsErrorPage());
44 } 44 }
45 45
46 // Tests CreateErrorPageNavigationContext factory method. 46 // Tests CreateErrorPageNavigationContext factory method.
47 TEST_F(NavigationContextImplTest, ErrorPageNavigationContext) { 47 TEST_F(NavigationContextImplTest, ErrorPageNavigationContext) {
48 std::unique_ptr<NavigationContext> context = 48 std::unique_ptr<NavigationContext> context =
49 NavigationContextImpl::CreateErrorPageNavigationContext(&web_state_, 49 NavigationContextImpl::CreateErrorPageNavigationContext(&web_state_,
50 url_); 50 url_);
51 ASSERT_TRUE(context); 51 ASSERT_TRUE(context);
52 52
53 EXPECT_EQ(&web_state_, context->GetWebState()); 53 EXPECT_EQ(&web_state_, context->GetWebState());
54 EXPECT_EQ(url_, context->GetUrl()); 54 EXPECT_EQ(url_, context->GetUrl());
55 EXPECT_FALSE(context->IsSamePage()); 55 EXPECT_FALSE(context->IsSameDocument());
56 EXPECT_TRUE(context->IsErrorPage()); 56 EXPECT_TRUE(context->IsErrorPage());
57 } 57 }
58 58
59 } // namespace web 59 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | ios/web/web_state/web_state_impl_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698