OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sessions/session_utils.h" | 5 #include "chrome/browser/sessions/session_utils.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/sessions/session_types.h" | 10 #include "chrome/browser/sessions/session_types.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 class TabNavigationMock : public TabNavigation { | 14 class TabNavigationMock : public TabNavigation { |
15 public: | 15 public: |
16 TabNavigationMock(const char* url, const char* title) | 16 TabNavigationMock(const char* url, const char* title) |
17 : TabNavigation(0, // index | 17 : TabNavigation(0, // index |
18 GURL(string16(ASCIIToUTF16(url))), // virtual_url | 18 GURL(string16(ASCIIToUTF16(url))), // virtual_url |
19 GURL(), // referrer | 19 GURL(), // referrer |
20 string16(ASCIIToUTF16(title)), // title | 20 string16(ASCIIToUTF16(title)), // title |
21 "", // state | 21 "", // state |
22 PageTransition::FROM_ADDRESS_BAR) { | 22 content::PAGE_TRANSITION_FROM_ADDRESS_BAR) { |
23 } | 23 } |
24 }; | 24 }; |
25 | 25 |
26 class SessionUtilsTest : public testing::Test { | 26 class SessionUtilsTest : public testing::Test { |
27 protected: | 27 protected: |
28 class TabMock : public TabRestoreService::Tab { | 28 class TabMock : public TabRestoreService::Tab { |
29 public: | 29 public: |
30 TabMock(const char* url, const char* title) { | 30 TabMock(const char* url, const char* title) { |
31 navigations.push_back(TabNavigationMock(url, title)); | 31 navigations.push_back(TabNavigationMock(url, title)); |
32 current_navigation_index = 0; | 32 current_navigation_index = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ASSERT_EQ(7U, filtered_entries.size()); | 67 ASSERT_EQ(7U, filtered_entries.size()); |
68 | 68 |
69 // The filtering should have removed the second item | 69 // The filtering should have removed the second item |
70 TabRestoreService::Entries expected = entries_; | 70 TabRestoreService::Entries expected = entries_; |
71 TabRestoreService::Entry* first = expected.front(); | 71 TabRestoreService::Entry* first = expected.front(); |
72 expected.pop_front(); | 72 expected.pop_front(); |
73 expected.pop_front(); | 73 expected.pop_front(); |
74 expected.push_front(first); | 74 expected.push_front(first); |
75 ASSERT_EQ(expected, filtered_entries); | 75 ASSERT_EQ(expected, filtered_entries); |
76 } | 76 } |
OLD | NEW |