Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / profile_resetter / profile_resetter_test_base.cc
blobf149672b2859269b97ab363f73c4b4312e3d47d1
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 <string>
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;
18 runner_->Run();
19 runner_ = NULL;
22 void ProfileResetterMockObject::StopLoop() {
23 DCHECK(runner_.get());
24 Callback();
25 runner_->Quit();
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(),
38 false,
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(),
51 false,
52 base::Bind(&ProfileResetterMockObject::StopLoop,
53 base::Unretained(&mock_object_)));
54 mock_object_.RunLoop();