OLD | NEW |
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/profile_resetter/profile_resetter_test_base.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" |
6 | 6 |
| 7 #include <string> |
| 8 |
7 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" | 9 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" |
8 | 10 |
9 ProfileResetterMockObject::ProfileResetterMockObject() {} | 11 ProfileResetterMockObject::ProfileResetterMockObject() {} |
10 | 12 |
11 ProfileResetterMockObject::~ProfileResetterMockObject() {} | 13 ProfileResetterMockObject::~ProfileResetterMockObject() {} |
12 | 14 |
13 void ProfileResetterMockObject::RunLoop() { | 15 void ProfileResetterMockObject::RunLoop() { |
14 EXPECT_CALL(*this, Callback()); | 16 EXPECT_CALL(*this, Callback()); |
15 runner_ = new content::MessageLoopRunner; | 17 runner_ = new content::MessageLoopRunner; |
16 runner_->Run(); | 18 runner_->Run(); |
17 runner_ = NULL; | 19 runner_ = NULL; |
18 } | 20 } |
19 | 21 |
20 void ProfileResetterMockObject::StopLoop() { | 22 void ProfileResetterMockObject::StopLoop() { |
21 DCHECK(runner_.get()); | 23 DCHECK(runner_.get()); |
22 Callback(); | 24 Callback(); |
23 runner_->Quit(); | 25 runner_->Quit(); |
24 } | 26 } |
25 | 27 |
26 ProfileResetterTestBase::ProfileResetterTestBase() {} | 28 ProfileResetterTestBase::ProfileResetterTestBase() {} |
27 | 29 |
28 ProfileResetterTestBase::~ProfileResetterTestBase() {} | 30 ProfileResetterTestBase::~ProfileResetterTestBase() {} |
29 | 31 |
30 void ProfileResetterTestBase::ResetAndWait( | 32 void ProfileResetterTestBase::ResetAndWait( |
31 ProfileResetter::ResettableFlags resettable_flags) { | 33 ProfileResetter::ResettableFlags resettable_flags) { |
32 scoped_ptr<BrandcodedDefaultSettings> master_settings( | 34 scoped_ptr<BrandcodedDefaultSettings> master_settings( |
33 new BrandcodedDefaultSettings); | 35 new BrandcodedDefaultSettings); |
34 resetter_->Reset(resettable_flags, | 36 resetter_->Reset(resettable_flags, |
35 master_settings.Pass(), | 37 master_settings.Pass(), |
| 38 false, |
36 base::Bind(&ProfileResetterMockObject::StopLoop, | 39 base::Bind(&ProfileResetterMockObject::StopLoop, |
37 base::Unretained(&mock_object_))); | 40 base::Unretained(&mock_object_))); |
38 mock_object_.RunLoop(); | 41 mock_object_.RunLoop(); |
39 } | 42 } |
40 | 43 |
41 void ProfileResetterTestBase::ResetAndWait( | 44 void ProfileResetterTestBase::ResetAndWait( |
42 ProfileResetter::ResettableFlags resettable_flags, | 45 ProfileResetter::ResettableFlags resettable_flags, |
43 const std::string& prefs) { | 46 const std::string& prefs) { |
44 scoped_ptr<BrandcodedDefaultSettings> master_settings( | 47 scoped_ptr<BrandcodedDefaultSettings> master_settings( |
45 new BrandcodedDefaultSettings(prefs)); | 48 new BrandcodedDefaultSettings(prefs)); |
46 resetter_->Reset(resettable_flags, | 49 resetter_->Reset(resettable_flags, |
47 master_settings.Pass(), | 50 master_settings.Pass(), |
| 51 false, |
48 base::Bind(&ProfileResetterMockObject::StopLoop, | 52 base::Bind(&ProfileResetterMockObject::StopLoop, |
49 base::Unretained(&mock_object_))); | 53 base::Unretained(&mock_object_))); |
50 mock_object_.RunLoop(); | 54 mock_object_.RunLoop(); |
51 } | 55 } |
OLD | NEW |