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