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

Side by Side Diff: content/browser/web_contents/navigation_controller_impl_unittest.cc

Issue 11054025: [Sync] Add HTTP status codes to NavigationEntry and TabNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), -1); 198 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), -1);
199 EXPECT_EQ(controller.GetPendingEntryIndex(), -1); 199 EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
200 EXPECT_FALSE(controller.GetLastCommittedEntry()); 200 EXPECT_FALSE(controller.GetLastCommittedEntry());
201 ASSERT_TRUE(controller.GetPendingEntry()); 201 ASSERT_TRUE(controller.GetPendingEntry());
202 EXPECT_EQ(controller.GetPendingEntry(), controller.GetActiveEntry()); 202 EXPECT_EQ(controller.GetPendingEntry(), controller.GetActiveEntry());
203 EXPECT_EQ(controller.GetPendingEntry(), controller.GetVisibleEntry()); 203 EXPECT_EQ(controller.GetPendingEntry(), controller.GetVisibleEntry());
204 EXPECT_FALSE(controller.CanGoBack()); 204 EXPECT_FALSE(controller.CanGoBack());
205 EXPECT_FALSE(controller.CanGoForward()); 205 EXPECT_FALSE(controller.CanGoForward());
206 EXPECT_EQ(contents()->GetMaxPageID(), -1); 206 EXPECT_EQ(contents()->GetMaxPageID(), -1);
207 207
208 // The timestamp should not have been set yet. 208 // Neither the timestamp nor the status code should have been set
209 // yet.
209 EXPECT_TRUE(controller.GetPendingEntry()->GetTimestamp().is_null()); 210 EXPECT_TRUE(controller.GetPendingEntry()->GetTimestamp().is_null());
211 EXPECT_EQ(0, controller.GetPendingEntry()->GetHttpStatusCode());
210 212
211 // We should have gotten no notifications from the preceeding checks. 213 // We should have gotten no notifications from the preceeding checks.
212 EXPECT_EQ(0U, notifications.size()); 214 EXPECT_EQ(0U, notifications.size());
213 215
214 test_rvh()->SendNavigate(0, url1); 216 test_rvh()->SendNavigate(0, url1);
215 EXPECT_TRUE(notifications.Check1AndReset( 217 EXPECT_TRUE(notifications.Check1AndReset(
216 content::NOTIFICATION_NAV_ENTRY_COMMITTED)); 218 content::NOTIFICATION_NAV_ENTRY_COMMITTED));
217 219
218 // The load should now be committed. 220 // The load should now be committed.
219 EXPECT_EQ(controller.GetEntryCount(), 1); 221 EXPECT_EQ(controller.GetEntryCount(), 1);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 EXPECT_EQ(controller.GetPendingEntryIndex(), -1); 265 EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
264 EXPECT_TRUE(controller.GetLastCommittedEntry()); 266 EXPECT_TRUE(controller.GetLastCommittedEntry());
265 EXPECT_FALSE(controller.GetPendingEntry()); 267 EXPECT_FALSE(controller.GetPendingEntry());
266 ASSERT_TRUE(controller.GetActiveEntry()); 268 ASSERT_TRUE(controller.GetActiveEntry());
267 EXPECT_EQ(controller.GetActiveEntry(), controller.GetVisibleEntry()); 269 EXPECT_EQ(controller.GetActiveEntry(), controller.GetVisibleEntry());
268 EXPECT_TRUE(controller.CanGoBack()); 270 EXPECT_TRUE(controller.CanGoBack());
269 EXPECT_FALSE(controller.CanGoForward()); 271 EXPECT_FALSE(controller.CanGoForward());
270 EXPECT_EQ(contents()->GetMaxPageID(), 1); 272 EXPECT_EQ(contents()->GetMaxPageID(), 1);
271 273
272 EXPECT_FALSE(controller.GetActiveEntry()->GetTimestamp().is_null()); 274 EXPECT_FALSE(controller.GetActiveEntry()->GetTimestamp().is_null());
275 EXPECT_EQ(200, controller.GetActiveEntry()->GetHttpStatusCode());
273 } 276 }
274 277
275 void CheckNavigationEntryMatchLoadParams( 278 void CheckNavigationEntryMatchLoadParams(
276 NavigationController::LoadURLParams& load_params, 279 NavigationController::LoadURLParams& load_params,
277 NavigationEntryImpl* entry) { 280 NavigationEntryImpl* entry) {
278 EXPECT_EQ(load_params.url, entry->GetURL()); 281 EXPECT_EQ(load_params.url, entry->GetURL());
279 EXPECT_EQ(load_params.referrer.url, entry->GetReferrer().url); 282 EXPECT_EQ(load_params.referrer.url, entry->GetReferrer().url);
280 EXPECT_EQ(load_params.referrer.policy, entry->GetReferrer().policy); 283 EXPECT_EQ(load_params.referrer.policy, entry->GetReferrer().policy);
281 EXPECT_EQ(load_params.transition_type, entry->GetTransitionType()); 284 EXPECT_EQ(load_params.transition_type, entry->GetTransitionType());
282 EXPECT_EQ(load_params.extra_headers, entry->extra_headers()); 285 EXPECT_EQ(load_params.extra_headers, entry->extra_headers());
(...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 TabNavigation nav(0, url0, GURL(), string16(), 3050 TabNavigation nav(0, url0, GURL(), string16(),
3048 webkit_glue::CreateHistoryStateForURL(url0), 3051 webkit_glue::CreateHistoryStateForURL(url0),
3049 content::PAGE_TRANSITION_LINK); 3052 content::PAGE_TRANSITION_LINK);
3050 session_helper_.AssertNavigationEquals(nav, 3053 session_helper_.AssertNavigationEquals(nav,
3051 windows_[0]->tabs[0]->navigations[0]); 3054 windows_[0]->tabs[0]->navigations[0]);
3052 nav.set_url(url2); 3055 nav.set_url(url2);
3053 session_helper_.AssertNavigationEquals(nav, 3056 session_helper_.AssertNavigationEquals(nav,
3054 windows_[0]->tabs[0]->navigations[1]); 3057 windows_[0]->tabs[0]->navigations[1]);
3055 } 3058 }
3056 */ 3059 */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698