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"
9 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
11 ProfileResetterMockObject::ProfileResetterMockObject() {}
13 ProfileResetterMockObject::~ProfileResetterMockObject() {}
15 void ProfileResetterMockObject::RunLoop() {
16 EXPECT_CALL(*this, Callback());
17 runner_
= new content::MessageLoopRunner
;
22 void ProfileResetterMockObject::StopLoop() {
23 DCHECK(runner_
.get());
28 ProfileResetterTestBase::ProfileResetterTestBase() {}
30 ProfileResetterTestBase::~ProfileResetterTestBase() {}
32 void ProfileResetterTestBase::ResetAndWait(
33 ProfileResetter::ResettableFlags resettable_flags
) {
34 scoped_ptr
<BrandcodedDefaultSettings
> master_settings(
35 new BrandcodedDefaultSettings
);
36 resetter_
->Reset(resettable_flags
,
37 master_settings
.Pass(),
39 base::Bind(&ProfileResetterMockObject::StopLoop
,
40 base::Unretained(&mock_object_
)));
41 mock_object_
.RunLoop();
44 void ProfileResetterTestBase::ResetAndWait(
45 ProfileResetter::ResettableFlags resettable_flags
,
46 const std::string
& prefs
) {
47 scoped_ptr
<BrandcodedDefaultSettings
> master_settings(
48 new BrandcodedDefaultSettings(prefs
));
49 resetter_
->Reset(resettable_flags
,
50 master_settings
.Pass(),
52 base::Bind(&ProfileResetterMockObject::StopLoop
,
53 base::Unretained(&mock_object_
)));
54 mock_object_
.RunLoop();