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

Side by Side Diff: chrome/browser/tabs/pinned_tab_codec_unittest.cc

Issue 10384106: Extract StartupTabs and startup types from StartupBrowserCreator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tabs/pinned_tab_codec.cc ('k') | chrome/browser/tabs/pinned_tab_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "chrome/browser/tabs/pinned_tab_codec.h" 8 #include "chrome/browser/tabs/pinned_tab_codec.h"
9 #include "chrome/browser/tabs/pinned_tab_test_utils.h" 9 #include "chrome/browser/tabs/pinned_tab_test_utils.h"
10 #include "chrome/browser/tabs/tab_strip_model.h" 10 #include "chrome/browser/tabs/tab_strip_model.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/startup/startup_tab.h"
12 #include "chrome/test/base/browser_with_test_window_test.h" 13 #include "chrome/test/base/browser_with_test_window_test.h"
13 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 typedef BrowserWithTestWindowTest PinnedTabCodecTest; 17 typedef BrowserWithTestWindowTest PinnedTabCodecTest;
17 18
18 // Make sure nothing is restored when the browser has no pinned tabs. 19 // Make sure nothing is restored when the browser has no pinned tabs.
19 TEST_F(PinnedTabCodecTest, NoPinnedTabs) { 20 TEST_F(PinnedTabCodecTest, NoPinnedTabs) {
20 GURL url1("http://www.google.com"); 21 GURL url1("http://www.google.com");
21 AddTab(browser(), url1); 22 AddTab(browser(), url1);
(...skipping 12 matching lines...) Expand all
34 GURL url2("http://www.google.com/2"); 35 GURL url2("http://www.google.com/2");
35 AddTab(browser(), url2); 36 AddTab(browser(), url2);
36 37
37 // AddTab inserts at index 0, so order after this is url1, url2. 38 // AddTab inserts at index 0, so order after this is url1, url2.
38 AddTab(browser(), url1); 39 AddTab(browser(), url1);
39 40
40 browser()->tabstrip_model()->SetTabPinned(0, true); 41 browser()->tabstrip_model()->SetTabPinned(0, true);
41 42
42 PinnedTabCodec::WritePinnedTabs(profile()); 43 PinnedTabCodec::WritePinnedTabs(profile());
43 44
44 PinnedTabCodec::Tabs pinned_tabs = PinnedTabCodec::ReadPinnedTabs(profile()); 45 StartupTabs pinned_tabs = PinnedTabCodec::ReadPinnedTabs(profile());
45 std::string result = PinnedTabTestUtils::TabsToString(pinned_tabs); 46 std::string result = PinnedTabTestUtils::TabsToString(pinned_tabs);
46 EXPECT_EQ("http://www.google.com/::pinned:", result); 47 EXPECT_EQ("http://www.google.com/::pinned:", result);
47 48
48 // Update pinned tabs and restore back the old value directly. 49 // Update pinned tabs and restore back the old value directly.
49 browser()->tabstrip_model()->SetTabPinned(1, true); 50 browser()->tabstrip_model()->SetTabPinned(1, true);
50 51
51 PinnedTabCodec::WritePinnedTabs(profile()); 52 PinnedTabCodec::WritePinnedTabs(profile());
52 result = PinnedTabTestUtils::TabsToString( 53 result = PinnedTabTestUtils::TabsToString(
53 PinnedTabCodec::ReadPinnedTabs(profile())); 54 PinnedTabCodec::ReadPinnedTabs(profile()));
54 EXPECT_EQ("http://www.google.com/::pinned: http://www.google.com/2::pinned:", 55 EXPECT_EQ("http://www.google.com/::pinned: http://www.google.com/2::pinned:",
55 result); 56 result);
56 57
57 PinnedTabCodec::WritePinnedTabs(profile(), pinned_tabs); 58 PinnedTabCodec::WritePinnedTabs(profile(), pinned_tabs);
58 result = PinnedTabTestUtils::TabsToString( 59 result = PinnedTabTestUtils::TabsToString(
59 PinnedTabCodec::ReadPinnedTabs(profile())); 60 PinnedTabCodec::ReadPinnedTabs(profile()));
60 EXPECT_EQ("http://www.google.com/::pinned:", result); 61 EXPECT_EQ("http://www.google.com/::pinned:", result);
61 } 62 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/pinned_tab_codec.cc ('k') | chrome/browser/tabs/pinned_tab_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698