Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / profile_resetter / profile_resetter_test_base.h
blob178035c5cbbc2555c855fbfda0e756724a3336ea
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 #ifndef CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_TEST_BASE_H_
6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_TEST_BASE_H_
8 #include "chrome/browser/profile_resetter/profile_resetter.h"
9 #include "content/public/test/test_utils.h"
10 #include "testing/gmock/include/gmock/gmock.h"
12 // The ProfileResetterMockObject is used to block the thread until
13 // ProfileResetter::Reset has completed:
15 // ProfileResetterMockObject mock_object;
16 // resetter_->Reset(ProfileResetter::ALL,
17 // pointer,
18 // base::Bind(&ProfileResetterMockObject::StopLoop,
19 // base::Unretained(&mock_object)));
20 // mock_object.RunLoop();
21 class ProfileResetterMockObject {
22 public:
23 ProfileResetterMockObject();
24 ~ProfileResetterMockObject();
26 void RunLoop();
27 void StopLoop();
29 private:
30 MOCK_METHOD0(Callback, void(void));
32 scoped_refptr<content::MessageLoopRunner> runner_;
34 DISALLOW_COPY_AND_ASSIGN(ProfileResetterMockObject);
37 // Base class for all ProfileResetter unit tests.
38 class ProfileResetterTestBase {
39 public:
40 ProfileResetterTestBase();
41 ~ProfileResetterTestBase();
43 void ResetAndWait(ProfileResetter::ResettableFlags resettable_flags);
44 void ResetAndWait(ProfileResetter::ResettableFlags resettable_flags,
45 const std::string& prefs);
46 protected:
47 testing::StrictMock<ProfileResetterMockObject> mock_object_;
48 scoped_ptr<ProfileResetter> resetter_;
50 private:
51 DISALLOW_COPY_AND_ASSIGN(ProfileResetterTestBase);
54 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_TEST_BASE_H_