OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/prefs/session_startup_pref.h" | 9 #include "chrome/browser/prefs/session_startup_pref.h" |
10 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 10 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class MockObject { | 18 class MockObject { |
19 public: | 19 public: |
20 void RunLoop() { | 20 void RunLoop() { |
21 EXPECT_CALL(*this, Callback()); | 21 EXPECT_CALL(*this, Callback()); |
22 runner_ = new content::MessageLoopRunner; | 22 runner_ = new content::MessageLoopRunner; |
23 runner_->Run(); | 23 runner_->Run(); |
24 } | 24 } |
25 | 25 |
26 void StopLoop() { | 26 void StopLoop() { |
27 DCHECK(runner_); | 27 DCHECK(runner_.get()); |
28 Callback(); | 28 Callback(); |
29 runner_->Quit(); | 29 runner_->Quit(); |
30 } | 30 } |
31 | 31 |
32 private: | 32 private: |
33 MOCK_METHOD0(Callback, void(void)); | 33 MOCK_METHOD0(Callback, void(void)); |
34 | 34 |
35 scoped_refptr<content::MessageLoopRunner> runner_; | 35 scoped_refptr<content::MessageLoopRunner> runner_; |
36 }; | 36 }; |
37 | 37 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 TEST_F(ProfileResetterTest, ResetExtensionsAll) { | 145 TEST_F(ProfileResetterTest, ResetExtensionsAll) { |
146 // mock_object_ is a StrictMock, so we verify that it is called only once. | 146 // mock_object_ is a StrictMock, so we verify that it is called only once. |
147 resetter_->Reset( | 147 resetter_->Reset( |
148 ProfileResetter::ALL, | 148 ProfileResetter::ALL, |
149 ProfileResetter::UNINSTALL_EXTENSIONS, | 149 ProfileResetter::UNINSTALL_EXTENSIONS, |
150 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); | 150 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); |
151 mock_object_.RunLoop(); | 151 mock_object_.RunLoop(); |
152 } | 152 } |
153 | 153 |
154 } // namespace | 154 } // namespace |
OLD | NEW |