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

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

Issue 10332117: Revert 136573 - 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"
13 #include "chrome/test/base/browser_with_test_window_test.h" 12 #include "chrome/test/base/browser_with_test_window_test.h"
14 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 15
17 typedef BrowserWithTestWindowTest PinnedTabCodecTest; 16 typedef BrowserWithTestWindowTest PinnedTabCodecTest;
18 17
19 // Make sure nothing is restored when the browser has no pinned tabs. 18 // Make sure nothing is restored when the browser has no pinned tabs.
20 TEST_F(PinnedTabCodecTest, NoPinnedTabs) { 19 TEST_F(PinnedTabCodecTest, NoPinnedTabs) {
21 GURL url1("http://www.google.com"); 20 GURL url1("http://www.google.com");
22 AddTab(browser(), url1); 21 AddTab(browser(), url1);
(...skipping 12 matching lines...) Expand all
35 GURL url2("http://www.google.com/2"); 34 GURL url2("http://www.google.com/2");
36 AddTab(browser(), url2); 35 AddTab(browser(), url2);
37 36
38 // AddTab inserts at index 0, so order after this is url1, url2. 37 // AddTab inserts at index 0, so order after this is url1, url2.
39 AddTab(browser(), url1); 38 AddTab(browser(), url1);
40 39
41 browser()->tabstrip_model()->SetTabPinned(0, true); 40 browser()->tabstrip_model()->SetTabPinned(0, true);
42 41
43 PinnedTabCodec::WritePinnedTabs(profile()); 42 PinnedTabCodec::WritePinnedTabs(profile());
44 43
45 StartupTabs pinned_tabs = PinnedTabCodec::ReadPinnedTabs(profile()); 44 PinnedTabCodec::Tabs pinned_tabs = PinnedTabCodec::ReadPinnedTabs(profile());
46 std::string result = PinnedTabTestUtils::TabsToString(pinned_tabs); 45 std::string result = PinnedTabTestUtils::TabsToString(pinned_tabs);
47 EXPECT_EQ("http://www.google.com/::pinned:", result); 46 EXPECT_EQ("http://www.google.com/::pinned:", result);
48 47
49 // Update pinned tabs and restore back the old value directly. 48 // Update pinned tabs and restore back the old value directly.
50 browser()->tabstrip_model()->SetTabPinned(1, true); 49 browser()->tabstrip_model()->SetTabPinned(1, true);
51 50
52 PinnedTabCodec::WritePinnedTabs(profile()); 51 PinnedTabCodec::WritePinnedTabs(profile());
53 result = PinnedTabTestUtils::TabsToString( 52 result = PinnedTabTestUtils::TabsToString(
54 PinnedTabCodec::ReadPinnedTabs(profile())); 53 PinnedTabCodec::ReadPinnedTabs(profile()));
55 EXPECT_EQ("http://www.google.com/::pinned: http://www.google.com/2::pinned:", 54 EXPECT_EQ("http://www.google.com/::pinned: http://www.google.com/2::pinned:",
56 result); 55 result);
57 56
58 PinnedTabCodec::WritePinnedTabs(profile(), pinned_tabs); 57 PinnedTabCodec::WritePinnedTabs(profile(), pinned_tabs);
59 result = PinnedTabTestUtils::TabsToString( 58 result = PinnedTabTestUtils::TabsToString(
60 PinnedTabCodec::ReadPinnedTabs(profile())); 59 PinnedTabCodec::ReadPinnedTabs(profile()));
61 EXPECT_EQ("http://www.google.com/::pinned:", result); 60 EXPECT_EQ("http://www.google.com/::pinned:", result);
62 } 61 }
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