OLD | NEW |
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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DISALLOW_COPY_AND_ASSIGN(PinnedTabServiceTest); | 48 DISALLOW_COPY_AND_ASSIGN(PinnedTabServiceTest); |
49 }; | 49 }; |
50 | 50 |
51 // Makes sure closing a popup triggers writing pinned tabs. | 51 // Makes sure closing a popup triggers writing pinned tabs. |
52 TEST_F(PinnedTabServiceTest, Popup) { | 52 TEST_F(PinnedTabServiceTest, Popup) { |
53 GURL url("http://www.google.com"); | 53 GURL url("http://www.google.com"); |
54 AddTab(browser(), url); | 54 AddTab(browser(), url); |
55 browser()->tab_strip_model()->SetTabPinned(0, true); | 55 browser()->tab_strip_model()->SetTabPinned(0, true); |
56 | 56 |
57 // Create a popup. | 57 // Create a popup. |
58 Browser::CreateParams params(Browser::TYPE_POPUP, profile(), | 58 Browser::CreateParams params(Browser::TYPE_POPUP, profile()); |
59 browser()->host_desktop_type()); | |
60 scoped_ptr<Browser> popup( | 59 scoped_ptr<Browser> popup( |
61 chrome::CreateBrowserWithTestWindowForParams(¶ms)); | 60 chrome::CreateBrowserWithTestWindowForParams(¶ms)); |
62 | 61 |
63 // Close the browser. This should trigger saving the tabs. No need to destroy | 62 // Close the browser. This should trigger saving the tabs. No need to destroy |
64 // the browser (this happens automatically in the test destructor). | 63 // the browser (this happens automatically in the test destructor). |
65 browser()->OnWindowClosing(); | 64 browser()->OnWindowClosing(); |
66 | 65 |
67 std::string result = PinnedTabTestUtils::TabsToString( | 66 std::string result = PinnedTabTestUtils::TabsToString( |
68 PinnedTabCodec::ReadPinnedTabs(profile())); | 67 PinnedTabCodec::ReadPinnedTabs(profile())); |
69 EXPECT_EQ("http://www.google.com/:pinned", result); | 68 EXPECT_EQ("http://www.google.com/:pinned", result); |
70 | 69 |
71 // Close the popup. This shouldn't reset the saved state. | 70 // Close the popup. This shouldn't reset the saved state. |
72 popup->tab_strip_model()->CloseAllTabs(); | 71 popup->tab_strip_model()->CloseAllTabs(); |
73 popup.reset(NULL); | 72 popup.reset(NULL); |
74 | 73 |
75 // Check the state to make sure it hasn't changed. | 74 // Check the state to make sure it hasn't changed. |
76 result = PinnedTabTestUtils::TabsToString( | 75 result = PinnedTabTestUtils::TabsToString( |
77 PinnedTabCodec::ReadPinnedTabs(profile())); | 76 PinnedTabCodec::ReadPinnedTabs(profile())); |
78 EXPECT_EQ("http://www.google.com/:pinned", result); | 77 EXPECT_EQ("http://www.google.com/:pinned", result); |
79 } | 78 } |
80 | 79 |
81 } // namespace | 80 } // namespace |
OLD | NEW |