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

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

Issue 387763002: sync: Re-enable some migration integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/test/integration/status_change_checker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/status_change_checker.h" 5 #include "chrome/browser/sync/test/integration/status_change_checker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 10
11 StatusChangeChecker::StatusChangeChecker() 11 StatusChangeChecker::StatusChangeChecker() : timed_out_(false) {
12 : timed_out_(false), 12 }
13 wait_started_(false) {}
14 13
15 StatusChangeChecker::~StatusChangeChecker() {} 14 StatusChangeChecker::~StatusChangeChecker() {}
16 15
17 bool StatusChangeChecker::TimedOut() const { 16 bool StatusChangeChecker::TimedOut() const {
18 return timed_out_; 17 return timed_out_;
19 } 18 }
20 19
21 base::TimeDelta StatusChangeChecker::GetTimeoutDuration() { 20 base::TimeDelta StatusChangeChecker::GetTimeoutDuration() {
22 return base::TimeDelta::FromSeconds(45); 21 return base::TimeDelta::FromSeconds(45);
23 } 22 }
24 23
25 void StatusChangeChecker::StartBlockingWait() { 24 void StatusChangeChecker::StartBlockingWait() {
26 DCHECK(!wait_started_) << "This class is intended for one use only.";
27 wait_started_ = true;
28
29 base::OneShotTimer<StatusChangeChecker> timer; 25 base::OneShotTimer<StatusChangeChecker> timer;
30 timer.Start(FROM_HERE, 26 timer.Start(FROM_HERE,
31 GetTimeoutDuration(), 27 GetTimeoutDuration(),
32 base::Bind(&StatusChangeChecker::OnTimeout, 28 base::Bind(&StatusChangeChecker::OnTimeout,
33 base::Unretained(this))); 29 base::Unretained(this)));
34 30
35 { 31 {
36 base::MessageLoop* loop = base::MessageLoop::current(); 32 base::MessageLoop* loop = base::MessageLoop::current();
37 base::MessageLoop::ScopedNestableTaskAllower allow(loop); 33 base::MessageLoop::ScopedNestableTaskAllower allow(loop);
38 loop->Run(); 34 loop->Run();
(...skipping 10 matching lines...) Expand all
49 DVLOG(1) << "Await -> Condition met: " << GetDebugMessage(); 45 DVLOG(1) << "Await -> Condition met: " << GetDebugMessage();
50 StopWaiting(); 46 StopWaiting();
51 } 47 }
52 } 48 }
53 49
54 void StatusChangeChecker::OnTimeout() { 50 void StatusChangeChecker::OnTimeout() {
55 DVLOG(1) << "Await -> Timed out: " << GetDebugMessage(); 51 DVLOG(1) << "Await -> Timed out: " << GetDebugMessage();
56 timed_out_ = true; 52 timed_out_ = true;
57 StopWaiting(); 53 StopWaiting();
58 } 54 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/status_change_checker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698