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

Side by Side Diff: chrome/browser/ui/sync/tab_contents_synced_tab_delegate_unittest.cc

Issue 2777993002: [sync] Add regression test for TabContentsSyncedTabDelegate crash (Closed)
Patch Set: [sync] Add regression test for TabContentsSyncedTabDelegate crash 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
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698