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

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

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/fake_server_match_status_checker. h" 5 #include "chrome/browser/sync/test/integration/fake_server_match_status_checker. h"
6
6 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 7 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
7 #include "chrome/browser/sync/test/integration/sync_test.h" 8 #include "chrome/browser/sync/test/integration/sync_test.h"
8 9
9 namespace fake_server { 10 namespace fake_server {
10 11
11 FakeServerMatchStatusChecker::FakeServerMatchStatusChecker() 12 FakeServerMatchStatusChecker::FakeServerMatchStatusChecker()
12 : fake_server_(sync_datatype_helper::test()->GetFakeServer()) { 13 : fake_server_(sync_datatype_helper::test()->GetFakeServer()) {
13 DCHECK(fake_server_); 14 DCHECK(fake_server_);
15 fake_server_->AddObserver(this);
14 } 16 }
15 17
16 void FakeServerMatchStatusChecker::Wait() { 18 FakeServerMatchStatusChecker::~FakeServerMatchStatusChecker() {
17 DVLOG(1) << "Await: " << GetDebugMessage();
18
19 if (IsExitConditionSatisfied()) {
20 DVLOG(1) << "Await -> Exit before waiting: " << GetDebugMessage();
21 return;
22 }
23
24 fake_server_->AddObserver(this);
25 StartBlockingWait();
26 fake_server_->RemoveObserver(this); 19 fake_server_->RemoveObserver(this);
27 } 20 }
28 21
29 void FakeServerMatchStatusChecker::OnCommit( 22 void FakeServerMatchStatusChecker::OnCommit(
30 const std::string& committer_id, 23 const std::string& committer_id,
31 syncer::ModelTypeSet committed_model_types) { 24 syncer::ModelTypeSet committed_model_types) {
32 CheckExitCondition(); 25 CheckExitCondition();
33 } 26 }
34 27
35 fake_server::FakeServer* FakeServerMatchStatusChecker::fake_server() const { 28 fake_server::FakeServer* FakeServerMatchStatusChecker::fake_server() const {
36 return fake_server_; 29 return fake_server_;
37 } 30 }
38 31
39 } // namespace fake_server 32 } // namespace fake_server
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698