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 "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc" |
| 6 |
| 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 class TabContentsSyncedTabDelegateTest |
| 13 : public ChromeRenderViewHostTestHarness { |
| 14 public: |
| 15 TabContentsSyncedTabDelegateTest() : ChromeRenderViewHostTestHarness() {} |
| 16 ~TabContentsSyncedTabDelegateTest() override {} |
| 17 |
| 18 void SetUp() override { |
| 19 content::RenderViewHostTestHarness::SetUp(); |
| 20 |
| 21 NavigateAndCommit(GURL("about:blank")); |
| 22 TabContentsSyncedTabDelegate::CreateForWebContents(web_contents()); |
| 23 } |
| 24 }; |
| 25 |
| 26 TEST_F(TabContentsSyncedTabDelegateTest, InvalidEntryIndexReturnsDefault) { |
| 27 std::unique_ptr<content::WebContents> web_contents(CreateTestWebContents()); |
| 28 |
| 29 TabContentsSyncedTabDelegate::CreateForWebContents(web_contents.get()); |
| 30 |
| 31 TabContentsSyncedTabDelegate* delegate = |
| 32 TabContentsSyncedTabDelegate::FromWebContents(web_contents.get()); |
| 33 |
| 34 // -1 and 2 are invalid indices because there's only one navigation |
| 35 // recorded(the initial one to "about:blank") |
| 36 EXPECT_EQ(delegate->GetFaviconURLAtIndex(-1), GURL()); |
| 37 EXPECT_EQ(delegate->GetFaviconURLAtIndex(2), GURL()); |
| 38 |
| 39 EXPECT_TRUE( |
| 40 PageTransitionCoreTypeIs(delegate->GetTransitionAtIndex(-1), |
| 41 ui::PageTransition::PAGE_TRANSITION_LINK)); |
| 42 EXPECT_TRUE( |
| 43 PageTransitionCoreTypeIs(delegate->GetTransitionAtIndex(2), |
| 44 ui::PageTransition::PAGE_TRANSITION_LINK)); |
| 45 } |
| 46 |
| 47 } // namespace |
OLD | NEW |