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