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

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

Issue 10689157: Switch to TimeDelta interfaces for TestTimeouts in sync code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months 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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 it != urls.end(); ++it) { 114 it != urls.end(); ++it) {
115 DVLOG(1) << "Opening tab: " << it->spec() << " using profile " << index 115 DVLOG(1) << "Opening tab: " << it->spec() << " using profile " << index
116 << "."; 116 << ".";
117 chrome::ShowSingletonTab(browser, *it); 117 chrome::ShowSingletonTab(browser, *it);
118 } 118 }
119 return WaitForTabsToLoad(index, urls); 119 return WaitForTabsToLoad(index, urls);
120 } 120 }
121 121
122 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls) { 122 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls) {
123 DVLOG(1) << "Waiting for session to propagate to associator."; 123 DVLOG(1) << "Waiting for session to propagate to associator.";
124 static const int timeout_milli = TestTimeouts::action_max_timeout_ms();
125 base::TimeTicks start_time = base::TimeTicks::Now(); 124 base::TimeTicks start_time = base::TimeTicks::Now();
126 base::TimeTicks end_time = start_time + 125 base::TimeTicks end_time = start_time + TestTimeouts::action_max_timeout();
127 base::TimeDelta::FromMilliseconds(timeout_milli);
128 bool found; 126 bool found;
129 for (std::vector<GURL>::const_iterator it = urls.begin(); 127 for (std::vector<GURL>::const_iterator it = urls.begin();
130 it != urls.end(); ++it) { 128 it != urls.end(); ++it) {
131 found = false; 129 found = false;
132 while (!found) { 130 while (!found) {
133 found = ModelAssociatorHasTabWithUrl(index, *it); 131 found = ModelAssociatorHasTabWithUrl(index, *it);
134 if (base::TimeTicks::Now() >= end_time) { 132 if (base::TimeTicks::Now() >= end_time) {
135 LOG(ERROR) << "Failed to find all tabs after " << timeout_milli/1000.0 133 LOG(ERROR) << "Failed to find all tabs after " << timeout_milli/1000.0
136 << " seconds."; 134 << " seconds.";
137 return false; 135 return false;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 return true; 306 return true;
309 } 307 }
310 308
311 void DeleteForeignSession(int index, std::string session_tag) { 309 void DeleteForeignSession(int index, std::string session_tag) {
312 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 310 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
313 test()->GetProfile(index))-> 311 test()->GetProfile(index))->
314 GetSessionModelAssociator()->DeleteForeignSession(session_tag); 312 GetSessionModelAssociator()->DeleteForeignSession(session_tag);
315 } 313 }
316 314
317 } // namespace sessions_helper 315 } // namespace sessions_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698