| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 void OnFaviconsChanged(const std::set<GURL>& /* page_urls */, | 150 void OnFaviconsChanged(const std::set<GURL>& /* page_urls */, |
| 151 const GURL& /* icon_url */) override { | 151 const GURL& /* icon_url */) override { |
| 152 // Unwind to ensure SessionsSyncManager has processed the event. | 152 // Unwind to ensure SessionsSyncManager has processed the event. |
| 153 base::ThreadTaskRunnerHandle::Get()->PostTask( | 153 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 154 FROM_HERE, | 154 FROM_HERE, |
| 155 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr())); | 155 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr())); |
| 156 } | 156 } |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 void QuitLoop() { | 159 void QuitLoop() { base::MessageLoop::current()->QuitWhenIdle(); } |
| 160 base::MessageLoop::current()->Quit(); | |
| 161 } | |
| 162 | 160 |
| 163 base::WeakPtrFactory<TabEventHandler> weak_factory_; | 161 base::WeakPtrFactory<TabEventHandler> weak_factory_; |
| 164 }; | 162 }; |
| 165 | 163 |
| 166 } // namespace | 164 } // namespace |
| 167 | 165 |
| 168 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls) { | 166 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls) { |
| 169 DVLOG(1) << "Waiting for session to propagate to associator."; | 167 DVLOG(1) << "Waiting for session to propagate to associator."; |
| 170 base::TimeTicks start_time = base::TimeTicks::Now(); | 168 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 171 base::TimeTicks end_time = start_time + TestTimeouts::action_max_timeout(); | 169 base::TimeTicks end_time = start_time + TestTimeouts::action_max_timeout(); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 return !checker.TimedOut(); | 426 return !checker.TimedOut(); |
| 429 } | 427 } |
| 430 | 428 |
| 431 void DeleteForeignSession(int index, std::string session_tag) { | 429 void DeleteForeignSession(int index, std::string session_tag) { |
| 432 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 430 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
| 433 test()->GetProfile(index))-> | 431 test()->GetProfile(index))-> |
| 434 GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag); | 432 GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag); |
| 435 } | 433 } |
| 436 | 434 |
| 437 } // namespace sessions_helper | 435 } // namespace sessions_helper |
| OLD | NEW |