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

Side by Side Diff: chrome/browser/sync/glue/session_model_associator.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: Fix error messaging again. 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/glue/session_model_associator.h" 5 #include "chrome/browser/sync/glue/session_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 void SessionModelAssociator::QuitLoopForSubtleTesting() { 1560 void SessionModelAssociator::QuitLoopForSubtleTesting() {
1561 if (waiting_for_change_) { 1561 if (waiting_for_change_) {
1562 DVLOG(1) << "Quitting MessageLoop for test."; 1562 DVLOG(1) << "Quitting MessageLoop for test.";
1563 waiting_for_change_ = false; 1563 waiting_for_change_ = false;
1564 test_weak_factory_.InvalidateWeakPtrs(); 1564 test_weak_factory_.InvalidateWeakPtrs();
1565 MessageLoop::current()->Quit(); 1565 MessageLoop::current()->Quit();
1566 } 1566 }
1567 } 1567 }
1568 1568
1569 void SessionModelAssociator::BlockUntilLocalChangeForTest( 1569 void SessionModelAssociator::BlockUntilLocalChangeForTest(
1570 int64 timeout_milliseconds) { 1570 base::TimeDelta timeout) {
1571 if (test_weak_factory_.HasWeakPtrs()) 1571 if (test_weak_factory_.HasWeakPtrs())
1572 return; 1572 return;
1573 waiting_for_change_ = true; 1573 waiting_for_change_ = true;
1574 MessageLoop::current()->PostDelayedTask( 1574 MessageLoop::current()->PostDelayedTask(
1575 FROM_HERE, 1575 FROM_HERE,
1576 base::Bind(&SessionModelAssociator::QuitLoopForSubtleTesting, 1576 base::Bind(&SessionModelAssociator::QuitLoopForSubtleTesting,
1577 test_weak_factory_.GetWeakPtr()), 1577 test_weak_factory_.GetWeakPtr()),
1578 base::TimeDelta::FromMilliseconds(timeout_milliseconds)); 1578 timeout);
1579 } 1579 }
1580 1580
1581 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1581 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1582 // We only access the cryptographer while holding a transaction. 1582 // We only access the cryptographer while holding a transaction.
1583 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1583 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1584 const syncer::ModelTypeSet encrypted_types = 1584 const syncer::ModelTypeSet encrypted_types =
1585 syncer::GetEncryptedTypes(&trans); 1585 syncer::GetEncryptedTypes(&trans);
1586 return !encrypted_types.Has(SESSIONS) || 1586 return !encrypted_types.Has(SESSIONS) ||
1587 sync_service_->IsCryptographerReady(&trans); 1587 sync_service_->IsCryptographerReady(&trans);
1588 } 1588 }
1589 1589
1590 } // namespace browser_sync 1590 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_model_associator.h ('k') | chrome/browser/sync/glue/typed_url_model_associator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698