Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/web/web_state/navigation_context_impl.h" | |
| 6 | |
| 7 #import "ios/web/public/test/fakes/test_web_state.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 #include "testing/platform_test.h" | |
| 10 | |
| 11 namespace web { | |
| 12 | |
| 13 // Test fixture for NavigationContextImplTest testing. | |
| 14 class PlatformTestNavigationContextImplTest : public PlatformTest { | |
|
rohitrao (ping after 24h)
2017/02/24 01:22:48
Could this fixture go into an anonymous namespace
Eugene But (OOO till 7-30)
2017/02/24 01:49:41
Fixed fixture name, that was a mistake.
As for an
| |
| 15 protected: | |
| 16 PlatformTestNavigationContextImplTest() : url_("https://chromium.test") {} | |
| 17 | |
| 18 TestWebState web_state_; | |
| 19 GURL url_; | |
| 20 }; | |
| 21 | |
| 22 // Tests CreateNavigationContext factory method. | |
| 23 TEST_F(PlatformTestNavigationContextImplTest, NavigationContext) { | |
| 24 std::unique_ptr<NavigationContext> context = | |
| 25 NavigationContextImpl::CreateNavigationContext(&web_state_, url_); | |
| 26 ASSERT_TRUE(context); | |
| 27 | |
| 28 EXPECT_EQ(&web_state_, context->GetWebState()); | |
| 29 EXPECT_EQ(url_, context->GetUrl()); | |
| 30 EXPECT_FALSE(context->IsSamePage()); | |
| 31 EXPECT_FALSE(context->IsErrorPage()); | |
| 32 } | |
| 33 | |
| 34 // Tests CreateSamePageNavigationContext factory method. | |
| 35 TEST_F(PlatformTestNavigationContextImplTest, SamePageNavigationContext) { | |
| 36 std::unique_ptr<NavigationContext> context = | |
| 37 NavigationContextImpl::CreateSamePageNavigationContext(&web_state_, url_); | |
| 38 ASSERT_TRUE(context); | |
| 39 | |
| 40 EXPECT_EQ(&web_state_, context->GetWebState()); | |
| 41 EXPECT_EQ(url_, context->GetUrl()); | |
| 42 EXPECT_TRUE(context->IsSamePage()); | |
| 43 EXPECT_FALSE(context->IsErrorPage()); | |
| 44 } | |
| 45 | |
| 46 // Tests CreateErrorPageNavigationContext factory method. | |
| 47 TEST_F(PlatformTestNavigationContextImplTest, ErrorPageNavigationContext) { | |
| 48 std::unique_ptr<NavigationContext> context = | |
| 49 NavigationContextImpl::CreateErrorPageNavigationContext(&web_state_, | |
| 50 url_); | |
| 51 ASSERT_TRUE(context); | |
| 52 | |
| 53 EXPECT_EQ(&web_state_, context->GetWebState()); | |
| 54 EXPECT_EQ(url_, context->GetUrl()); | |
| 55 EXPECT_FALSE(context->IsSamePage()); | |
| 56 EXPECT_TRUE(context->IsErrorPage()); | |
| 57 } | |
| 58 | |
| 59 } // namespace web | |
| OLD | NEW |