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

Side by Side Diff: chrome/browser/sync/test/integration/sessions_helper.cc

Issue 1408643002: [Sync] Componentize synced_tab_delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test broken by rebase Created 5 years, 1 month 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
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 "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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/test/test_timeouts.h" 15 #include "base/test/test_timeouts.h"
16 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/sync/profile_sync_service.h" 19 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/sync/profile_sync_service_factory.h" 20 #include "chrome/browser/sync/profile_sync_service_factory.h"
21 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" 21 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h"
22 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" 22 #include "chrome/browser/sync/sessions/sessions_sync_manager.h"
23 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke r.h" 23 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke r.h"
24 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 24 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
25 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 25 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
26 #include "chrome/browser/sync/test/integration/sync_test.h" 26 #include "chrome/browser/sync/test/integration/sync_test.h"
27 #include "chrome/browser/ui/singleton_tabs.h" 27 #include "chrome/browser/ui/singleton_tabs.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "components/sync_driver/open_tabs_ui_delegate.h" 29 #include "components/sync_driver/open_tabs_ui_delegate.h"
30 #include "components/sync_driver/sync_client.h"
30 #include "content/public/test/test_utils.h" 31 #include "content/public/test/test_utils.h"
31 #include "url/gurl.h" 32 #include "url/gurl.h"
32 33
33 using sync_datatype_helper::test; 34 using sync_datatype_helper::test;
34 35
35 namespace sessions_helper { 36 namespace sessions_helper {
36 37
37 ScopedWindowMap::ScopedWindowMap() { 38 ScopedWindowMap::ScopedWindowMap() {
38 } 39 }
39 40
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (base::TimeTicks::Now() >= end_time) { 177 if (base::TimeTicks::Now() >= end_time) {
177 LOG(ERROR) << "Failed to find all tabs after " 178 LOG(ERROR) << "Failed to find all tabs after "
178 << TestTimeouts::action_max_timeout().InSecondsF() 179 << TestTimeouts::action_max_timeout().InSecondsF()
179 << " seconds."; 180 << " seconds.";
180 return false; 181 return false;
181 } 182 }
182 if (!found) { 183 if (!found) {
183 TabEventHandler handler; 184 TabEventHandler handler;
184 browser_sync::NotificationServiceSessionsRouter router( 185 browser_sync::NotificationServiceSessionsRouter router(
185 test()->GetProfile(index), 186 test()->GetProfile(index),
187 ProfileSyncServiceFactory::GetInstance()
188 ->GetForProfile(test()->GetProfile(index))
189 ->GetSyncClient()
190 ->GetSyncSessionsClient(),
186 syncer::SyncableService::StartSyncFlare()); 191 syncer::SyncableService::StartSyncFlare());
187 router.StartRoutingTo(&handler); 192 router.StartRoutingTo(&handler);
188 content::RunMessageLoop(); 193 content::RunMessageLoop();
189 } 194 }
190 } 195 }
191 } 196 }
192 return true; 197 return true;
193 } 198 }
194 199
195 bool GetLocalWindows(int index, SessionWindowMap* local_windows) { 200 bool GetLocalWindows(int index, SessionWindowMap* local_windows) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 return !checker.TimedOut(); 431 return !checker.TimedOut();
427 } 432 }
428 433
429 void DeleteForeignSession(int index, std::string session_tag) { 434 void DeleteForeignSession(int index, std::string session_tag) {
430 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 435 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
431 test()->GetProfile(index))-> 436 test()->GetProfile(index))->
432 GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag); 437 GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag);
433 } 438 }
434 439
435 } // namespace sessions_helper 440 } // namespace sessions_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698