OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "components/browser_sync/profile_sync_service_mock.h" | 13 #include "components/browser_sync/profile_sync_service_mock.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 | 19 |
| 20 class KeyedService; |
| 21 class Profile; |
| 22 class TestingProfile; |
| 23 |
20 namespace content { | 24 namespace content { |
21 class BrowserContext; | 25 class BrowserContext; |
22 } | 26 } |
23 | 27 |
24 namespace sync_driver { | 28 namespace syncer { |
25 class SyncClient; | 29 class SyncClient; |
26 } | 30 } |
27 | 31 |
28 class KeyedService; | |
29 class Profile; | |
30 class TestingProfile; | |
31 | |
32 ACTION_P(Notify, type) { | 32 ACTION_P(Notify, type) { |
33 content::NotificationService::current()->Notify( | 33 content::NotificationService::current()->Notify( |
34 type, | 34 type, |
35 content::NotificationService::AllSources(), | 35 content::NotificationService::AllSources(), |
36 content::NotificationService::NoDetails()); | 36 content::NotificationService::NoDetails()); |
37 } | 37 } |
38 | 38 |
39 ACTION(QuitUIMessageLoop) { | 39 ACTION(QuitUIMessageLoop) { |
40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
41 base::MessageLoop::current()->QuitWhenIdle(); | 41 base::MessageLoop::current()->QuitWhenIdle(); |
42 } | 42 } |
43 | 43 |
44 // Helper methods for constructing ProfileSyncService mocks. | 44 // Helper methods for constructing ProfileSyncService mocks. |
45 browser_sync::ProfileSyncService::InitParams | 45 browser_sync::ProfileSyncService::InitParams |
46 CreateProfileSyncServiceParamsForTest(Profile* profile); | 46 CreateProfileSyncServiceParamsForTest(Profile* profile); |
47 browser_sync::ProfileSyncService::InitParams | 47 browser_sync::ProfileSyncService::InitParams |
48 CreateProfileSyncServiceParamsForTest( | 48 CreateProfileSyncServiceParamsForTest( |
49 std::unique_ptr<sync_driver::SyncClient> sync_client, | 49 std::unique_ptr<syncer::SyncClient> sync_client, |
50 Profile* profile); | 50 Profile* profile); |
51 | 51 |
52 // A utility used by sync tests to create a TestingProfile with a Google | 52 // A utility used by sync tests to create a TestingProfile with a Google |
53 // Services username stored in a (Testing)PrefService. | 53 // Services username stored in a (Testing)PrefService. |
54 std::unique_ptr<TestingProfile> MakeSignedInTestingProfile(); | 54 std::unique_ptr<TestingProfile> MakeSignedInTestingProfile(); |
55 | 55 |
56 // Helper routine to be used in conjunction with | 56 // Helper routine to be used in conjunction with |
57 // BrowserContextKeyedServiceFactory::SetTestingFactory(). | 57 // BrowserContextKeyedServiceFactory::SetTestingFactory(). |
58 std::unique_ptr<KeyedService> BuildMockProfileSyncService( | 58 std::unique_ptr<KeyedService> BuildMockProfileSyncService( |
59 content::BrowserContext* context); | 59 content::BrowserContext* context); |
60 | 60 |
61 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ | 61 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ |
OLD | NEW |