Chromium Code Reviews| 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/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
| 6 #include "chrome/browser/history/history_types.h" | 6 #include "chrome/browser/history/history_types.h" |
| 7 #include "chrome/browser/sessions/session_service.h" | 7 #include "chrome/browser/sessions/session_service.h" |
| 8 #include "chrome/browser/sessions/session_types.h" | 8 #include "chrome/browser/sessions/session_types.h" |
| 9 #include "chrome/browser/sessions/session_types_test_helper.h" | |
| 9 #include "chrome/browser/sync/profile_sync_service_harness.h" | 10 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 10 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 11 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 11 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 12 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" | 13 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" |
| 13 #include "sync/util/time.h" | 14 #include "sync/util/time.h" |
| 14 | 15 |
| 15 using sessions_helper::CheckInitialState; | 16 using sessions_helper::CheckInitialState; |
| 16 using sessions_helper::GetLocalWindows; | 17 using sessions_helper::GetLocalWindows; |
| 17 using sessions_helper::GetSessionData; | 18 using sessions_helper::GetSessionData; |
| 18 using sessions_helper::OpenTabAndGetLocalWindows; | 19 using sessions_helper::OpenTabAndGetLocalWindows; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); | 76 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); |
| 76 | 77 |
| 77 int found_navigations = 0; | 78 int found_navigations = 0; |
| 78 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); | 79 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); |
| 79 it != windows.Get()->end(); ++it) { | 80 it != windows.Get()->end(); ++it) { |
| 80 for (std::vector<SessionTab*>::const_iterator it2 = | 81 for (std::vector<SessionTab*>::const_iterator it2 = |
| 81 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { | 82 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { |
| 82 for (std::vector<TabNavigation>::const_iterator it3 = | 83 for (std::vector<TabNavigation>::const_iterator it3 = |
| 83 (*it2)->navigations.begin(); | 84 (*it2)->navigations.begin(); |
| 84 it3 != (*it2)->navigations.end(); ++it3) { | 85 it3 != (*it2)->navigations.end(); ++it3) { |
| 85 const base::Time timestamp = it3->timestamp(); | 86 const base::Time timestamp = SessionTypesTestHelper::GetTimestamp(*it3); |
| 86 | 87 |
| 87 history::URLRow virtual_row; | 88 history::URLRow virtual_row; |
| 88 ASSERT_TRUE(GetUrlFromClient(0, it3->virtual_url(), &virtual_row)); | 89 ASSERT_TRUE(GetUrlFromClient(0, it3->virtual_url(), &virtual_row)); |
| 89 const base::Time history_timestamp = virtual_row.last_visit(); | 90 const base::Time history_timestamp = virtual_row.last_visit(); |
| 90 | 91 |
| 91 ASSERT_EQ(timestamp, history_timestamp); | 92 ASSERT_EQ(timestamp, history_timestamp); |
| 92 ++found_navigations; | 93 ++found_navigations; |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 ASSERT_EQ(1, found_navigations); | 97 ASSERT_EQ(1, found_navigations); |
| 97 } | 98 } |
| 99 | |
| 100 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, ResponseCodeIsPreserved) { | |
| 101 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
| 102 | |
| 103 ASSERT_TRUE(CheckInitialState(0)); | |
| 104 | |
| 105 // We want a URL that doesn't 404 and has a non-empty title. | |
| 106 // about:version is simple to render, too. | |
| 107 const GURL url("about:version"); | |
| 108 | |
| 109 ScopedWindowMap windows; | |
| 110 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); | |
| 111 | |
| 112 int found_navigations = 0; | |
| 113 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); | |
| 114 it != windows.Get()->end(); ++it) { | |
| 115 for (std::vector<SessionTab*>::const_iterator it2 = | |
| 116 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { | |
| 117 for (std::vector<TabNavigation>::const_iterator it3 = | |
| 118 (*it2)->navigations.begin(); | |
| 119 it3 != (*it2)->navigations.end(); ++it3) { | |
| 120 EXPECT_EQ(200, SessionTypesTestHelper::GetHttpStatusCode(*it3)); | |
|
Nicolas Zea
2012/10/04 18:41:31
verify this navigation is for the proper url as we
| |
| 121 ++found_navigations; | |
| 122 } | |
| 123 } | |
| 124 } | |
| 125 ASSERT_EQ(1, found_navigations); | |
| 126 } | |
| OLD | NEW |