| 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 "chrome/browser/sync/test/integration/sessions_helper.h" | 5 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/sync/glue/session_model_associator.h" | 13 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 14 #include "chrome/browser/sync/profile_sync_service.h" | 14 #include "chrome/browser/sync/profile_sync_service.h" |
| 15 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_harness.h" | 16 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 17 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 17 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 18 #include "chrome/browser/sync/test/integration/sync_test.h" | 18 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 19 #include "chrome/browser/ui/singleton_tabs.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 20 #include "chrome/browser/ui/singleton_tabs.h" | |
| 21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 24 | 24 |
| 25 using sync_datatype_helper::test; | 25 using sync_datatype_helper::test; |
| 26 | 26 |
| 27 namespace sessions_helper { | 27 namespace sessions_helper { |
| 28 | 28 |
| 29 ScopedWindowMap::ScopedWindowMap() { | 29 ScopedWindowMap::ScopedWindowMap() { |
| 30 } | 30 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 CompareSyncedSessions); | 233 CompareSyncedSessions); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool NavigationEquals(const TabNavigation& expected, | 236 bool NavigationEquals(const TabNavigation& expected, |
| 237 const TabNavigation& actual) { | 237 const TabNavigation& actual) { |
| 238 if (expected.virtual_url() != actual.virtual_url()) { | 238 if (expected.virtual_url() != actual.virtual_url()) { |
| 239 LOG(ERROR) << "Expected url " << expected.virtual_url() | 239 LOG(ERROR) << "Expected url " << expected.virtual_url() |
| 240 << ", actual " << actual.virtual_url(); | 240 << ", actual " << actual.virtual_url(); |
| 241 return false; | 241 return false; |
| 242 } | 242 } |
| 243 if (expected.referrer().url != actual.referrer().url) { | 243 if (expected.GetReferrerForTest().url != actual.GetReferrerForTest().url) { |
| 244 LOG(ERROR) << "Expected referrer " << expected.referrer().url | 244 LOG(ERROR) << "Expected referrer " << expected.GetReferrerForTest().url |
| 245 << ", actual " << actual.referrer().url; | 245 << ", actual " << actual.GetReferrerForTest().url; |
| 246 return false; | 246 return false; |
| 247 } | 247 } |
| 248 if (expected.title() != actual.title()) { | 248 if (expected.title() != actual.title()) { |
| 249 LOG(ERROR) << "Expected title " << expected.title() | 249 LOG(ERROR) << "Expected title " << expected.title() |
| 250 << ", actual " << actual.title(); | 250 << ", actual " << actual.title(); |
| 251 return false; | 251 return false; |
| 252 } | 252 } |
| 253 if (expected.transition() != actual.transition()) { | 253 if (expected.GetTransitionTypeForTest() != |
| 254 LOG(ERROR) << "Expected transition " << expected.transition() | 254 actual.GetTransitionTypeForTest()) { |
| 255 << ", actual " << actual.transition(); | 255 LOG(ERROR) << "Expected transition " << expected.GetTransitionTypeForTest() |
| 256 << ", actual " << actual.GetTransitionTypeForTest(); |
| 256 return false; | 257 return false; |
| 257 } | 258 } |
| 258 return true; | 259 return true; |
| 259 } | 260 } |
| 260 | 261 |
| 261 bool WindowsMatch(const SessionWindowMap& win1, | 262 bool WindowsMatch(const SessionWindowMap& win1, |
| 262 const SessionWindowMap& win2) { | 263 const SessionWindowMap& win2) { |
| 263 SessionTab* client0_tab; | 264 SessionTab* client0_tab; |
| 264 SessionTab* client1_tab; | 265 SessionTab* client1_tab; |
| 265 if (win1.size() != win2.size()) | 266 if (win1.size() != win2.size()) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 return true; | 308 return true; |
| 308 } | 309 } |
| 309 | 310 |
| 310 void DeleteForeignSession(int index, std::string session_tag) { | 311 void DeleteForeignSession(int index, std::string session_tag) { |
| 311 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 312 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
| 312 test()->GetProfile(index))-> | 313 test()->GetProfile(index))-> |
| 313 GetSessionModelAssociator()->DeleteForeignSession(session_tag); | 314 GetSessionModelAssociator()->DeleteForeignSession(session_tag); |
| 314 } | 315 } |
| 315 | 316 |
| 316 } // namespace sessions_helper | 317 } // namespace sessions_helper |
| OLD | NEW |