| Index: chrome/browser/ui/sync/tab_contents_synced_tab_delegate_unittest.cc
|
| diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate_unittest.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2e59b903ac5481aeac975924e08a888c24bea5b9
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate_unittest.cc
|
| @@ -0,0 +1,47 @@
|
| +// 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 "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc"
|
| +
|
| +#include "chrome/test/base/chrome_render_view_host_test_harness.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace {
|
| +
|
| +class TabContentsSyncedTabDelegateTest
|
| + : public ChromeRenderViewHostTestHarness {
|
| + public:
|
| + TabContentsSyncedTabDelegateTest() : ChromeRenderViewHostTestHarness() {}
|
| + ~TabContentsSyncedTabDelegateTest() override {}
|
| +
|
| + void SetUp() override {
|
| + content::RenderViewHostTestHarness::SetUp();
|
| +
|
| + NavigateAndCommit(GURL("about:blank"));
|
| + TabContentsSyncedTabDelegate::CreateForWebContents(web_contents());
|
| + }
|
| +};
|
| +
|
| +TEST_F(TabContentsSyncedTabDelegateTest, InvalidEntryIndexReturnsDefault) {
|
| + std::unique_ptr<content::WebContents> web_contents(CreateTestWebContents());
|
| +
|
| + TabContentsSyncedTabDelegate::CreateForWebContents(web_contents.get());
|
| +
|
| + TabContentsSyncedTabDelegate* delegate =
|
| + TabContentsSyncedTabDelegate::FromWebContents(web_contents.get());
|
| +
|
| + // -1 and 2 are invalid indices because there's only one navigation
|
| + // recorded(the initial one to "about:blank")
|
| + EXPECT_EQ(delegate->GetFaviconURLAtIndex(-1), GURL());
|
| + EXPECT_EQ(delegate->GetFaviconURLAtIndex(2), GURL());
|
| +
|
| + EXPECT_TRUE(
|
| + PageTransitionCoreTypeIs(delegate->GetTransitionAtIndex(-1),
|
| + ui::PageTransition::PAGE_TRANSITION_LINK));
|
| + EXPECT_TRUE(
|
| + PageTransitionCoreTypeIs(delegate->GetTransitionAtIndex(2),
|
| + ui::PageTransition::PAGE_TRANSITION_LINK));
|
| +}
|
| +
|
| +} // namespace
|
|
|