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
3 // found in the LICENSE file.
5 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h"
7 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
9 ProfileResetterMockObject::ProfileResetterMockObject() {}
11 ProfileResetterMockObject::~ProfileResetterMockObject() {}
13 void ProfileResetterMockObject::RunLoop() {
14 EXPECT_CALL(*this, Callback());
15 runner_
= new content::MessageLoopRunner
;
20 void ProfileResetterMockObject::StopLoop() {
21 DCHECK(runner_
.get());
26 ProfileResetterTestBase::ProfileResetterTestBase() {}
28 ProfileResetterTestBase::~ProfileResetterTestBase() {}
30 void ProfileResetterTestBase::ResetAndWait(
31 ProfileResetter::ResettableFlags resettable_flags
) {
32 scoped_ptr
<BrandcodedDefaultSettings
> master_settings(
33 new BrandcodedDefaultSettings
);
34 resetter_
->Reset(resettable_flags
,
35 master_settings
.Pass(),
36 base::Bind(&ProfileResetterMockObject::StopLoop
,
37 base::Unretained(&mock_object_
)));
38 mock_object_
.RunLoop();
41 void ProfileResetterTestBase::ResetAndWait(
42 ProfileResetter::ResettableFlags resettable_flags
,
43 const std::string
& prefs
) {
44 scoped_ptr
<BrandcodedDefaultSettings
> master_settings(
45 new BrandcodedDefaultSettings(prefs
));
46 resetter_
->Reset(resettable_flags
,
47 master_settings
.Pass(),
48 base::Bind(&ProfileResetterMockObject::StopLoop
,
49 base::Unretained(&mock_object_
)));
50 mock_object_
.RunLoop();