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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 int index, | 77 int index, |
78 bool select) { | 78 bool select) { |
79 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 79 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
80 entry->SetURL(navigation.virtual_url()); | 80 entry->SetURL(navigation.virtual_url()); |
81 entry->SetReferrer(navigation.referrer()); | 81 entry->SetReferrer(navigation.referrer()); |
82 entry->SetTitle(navigation.title()); | 82 entry->SetTitle(navigation.title()); |
83 entry->SetContentState(navigation.state()); | 83 entry->SetContentState(navigation.state()); |
84 entry->SetTransitionType(navigation.transition()); | 84 entry->SetTransitionType(navigation.transition()); |
85 entry->SetHasPostData( | 85 entry->SetHasPostData( |
86 navigation.type_mask() & TabNavigation::HAS_POST_DATA); | 86 navigation.type_mask() & TabNavigation::HAS_POST_DATA); |
| 87 entry->SetOriginalRequestURL(navigation.original_request_url()); |
87 service()->UpdateTabNavigation(window_id, tab_id, index, *entry.get()); | 88 service()->UpdateTabNavigation(window_id, tab_id, index, *entry.get()); |
88 if (select) | 89 if (select) |
89 service()->SetSelectedNavigationIndex(window_id, tab_id, index); | 90 service()->SetSelectedNavigationIndex(window_id, tab_id, index); |
90 } | 91 } |
91 | 92 |
92 void ReadWindows(std::vector<SessionWindow*>* windows) { | 93 void ReadWindows(std::vector<SessionWindow*>* windows) { |
93 // Forces closing the file. | 94 // Forces closing the file. |
94 helper_.set_service(NULL); | 95 helper_.set_service(NULL); |
95 | 96 |
96 SessionService* session_service = new SessionService(path_); | 97 SessionService* session_service = new SessionService(path_); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 152 |
152 TEST_F(SessionServiceTest, Basic) { | 153 TEST_F(SessionServiceTest, Basic) { |
153 SessionID tab_id; | 154 SessionID tab_id; |
154 ASSERT_NE(window_id.id(), tab_id.id()); | 155 ASSERT_NE(window_id.id(), tab_id.id()); |
155 | 156 |
156 TabNavigation nav1(0, GURL("http://google.com"), | 157 TabNavigation nav1(0, GURL("http://google.com"), |
157 content::Referrer(GURL("http://www.referrer.com"), | 158 content::Referrer(GURL("http://www.referrer.com"), |
158 WebKit::WebReferrerPolicyDefault), | 159 WebKit::WebReferrerPolicyDefault), |
159 ASCIIToUTF16("abc"), "def", | 160 ASCIIToUTF16("abc"), "def", |
160 content::PAGE_TRANSITION_QUALIFIER_MASK); | 161 content::PAGE_TRANSITION_QUALIFIER_MASK); |
| 162 nav1.set_original_request_url(GURL("http://original.request.com")); |
161 | 163 |
162 helper_.PrepareTabInWindow(window_id, tab_id, 0, true); | 164 helper_.PrepareTabInWindow(window_id, tab_id, 0, true); |
163 UpdateNavigation(window_id, tab_id, nav1, 0, true); | 165 UpdateNavigation(window_id, tab_id, nav1, 0, true); |
164 | 166 |
165 ScopedVector<SessionWindow> windows; | 167 ScopedVector<SessionWindow> windows; |
166 ReadWindows(&(windows.get())); | 168 ReadWindows(&(windows.get())); |
167 | 169 |
168 ASSERT_EQ(1U, windows->size()); | 170 ASSERT_EQ(1U, windows->size()); |
169 ASSERT_TRUE(window_bounds == windows[0]->bounds); | 171 ASSERT_TRUE(window_bounds == windows[0]->bounds); |
170 ASSERT_EQ(0, windows[0]->selected_tab_index); | 172 ASSERT_EQ(0, windows[0]->selected_tab_index); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 ASSERT_TRUE(file_util::CopyFile(v1_file_path, dest_file_path)); | 876 ASSERT_TRUE(file_util::CopyFile(v1_file_path, dest_file_path)); |
875 | 877 |
876 SessionService* session_service = new SessionService(path_); | 878 SessionService* session_service = new SessionService(path_); |
877 helper_.set_service(session_service); | 879 helper_.set_service(session_service); |
878 ScopedVector<SessionWindow> windows; | 880 ScopedVector<SessionWindow> windows; |
879 helper_.ReadWindows(&(windows.get())); | 881 helper_.ReadWindows(&(windows.get())); |
880 ASSERT_EQ(1u, windows.size()); | 882 ASSERT_EQ(1u, windows.size()); |
881 EXPECT_EQ(1u, windows[0]->tabs.size()); | 883 EXPECT_EQ(1u, windows[0]->tabs.size()); |
882 } | 884 } |
883 #endif | 885 #endif |
OLD | NEW |