| Index: ios/web/web_state/navigation_handle_impl_unittest.mm
|
| diff --git a/ios/web/web_state/navigation_handle_impl_unittest.mm b/ios/web/web_state/navigation_handle_impl_unittest.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..26ba1e4273900a5c3e2529e53ed7a323cd6ca795
|
| --- /dev/null
|
| +++ b/ios/web/web_state/navigation_handle_impl_unittest.mm
|
| @@ -0,0 +1,58 @@
|
| +// 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_handle_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 NavigationHandleImplTest testing.
|
| +class PlatformTestNavigationHandleImplTest : public PlatformTest {
|
| + protected:
|
| + PlatformTestNavigationHandleImplTest() : url_("https://chromium.test") {}
|
| +
|
| + TestWebState web_state_;
|
| + GURL url_;
|
| +};
|
| +
|
| +// Tests CreateNavigationHandle factory method.
|
| +TEST_F(PlatformTestNavigationHandleImplTest, NavigationHandle) {
|
| + std::unique_ptr<NavigationHandle> handle =
|
| + NavigationHandleImpl::CreateNavigationHandle(&web_state_, url_);
|
| + ASSERT_TRUE(handle);
|
| +
|
| + EXPECT_EQ(&web_state_, handle->GetWebState());
|
| + EXPECT_EQ(url_, handle->GetUrl());
|
| + EXPECT_FALSE(handle->IsSamePage());
|
| + EXPECT_FALSE(handle->IsErrorPage());
|
| +}
|
| +
|
| +// Tests CreateSamePageNavigationHandle factory method.
|
| +TEST_F(PlatformTestNavigationHandleImplTest, SamePageNavigationHandle) {
|
| + std::unique_ptr<NavigationHandle> handle =
|
| + NavigationHandleImpl::CreateSamePageNavigationHandle(&web_state_, url_);
|
| + ASSERT_TRUE(handle);
|
| +
|
| + EXPECT_EQ(&web_state_, handle->GetWebState());
|
| + EXPECT_EQ(url_, handle->GetUrl());
|
| + EXPECT_TRUE(handle->IsSamePage());
|
| + EXPECT_FALSE(handle->IsErrorPage());
|
| +}
|
| +
|
| +// Tests CreateErrorPageNavigationHandle factory method.
|
| +TEST_F(PlatformTestNavigationHandleImplTest, ErrorPageNavigationHandle) {
|
| + std::unique_ptr<NavigationHandle> handle =
|
| + NavigationHandleImpl::CreateErrorPageNavigationHandle(&web_state_, url_);
|
| + ASSERT_TRUE(handle);
|
| +
|
| + EXPECT_EQ(&web_state_, handle->GetWebState());
|
| + EXPECT_EQ(url_, handle->GetUrl());
|
| + EXPECT_FALSE(handle->IsSamePage());
|
| + EXPECT_TRUE(handle->IsErrorPage());
|
| +}
|
| +
|
| +} // namespace web
|
|
|