OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/memory/scoped_ptr.h" |
5 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
6 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h" | 7 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_gcm_app_handler.h" | 9 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | 11 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
11 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 12 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
12 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_fa
ctory.h" | 13 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_fa
ctory.h" |
13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/extensions/features/feature_channel.h" | 15 #include "chrome/common/extensions/features/feature_channel.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
16 #include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h" | 17 #include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h" |
17 #include "extensions/test/result_catcher.h" | 18 #include "extensions/test/result_catcher.h" |
18 | 19 |
19 using extensions::ResultCatcher; | 20 using extensions::ResultCatcher; |
20 | 21 |
21 namespace extensions { | 22 namespace extensions { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 KeyedService* BuildFakeGCMProfileService(content::BrowserContext* context) { | 26 scoped_ptr<KeyedService> BuildFakeGCMProfileService( |
26 gcm::FakeGCMProfileService* service = | 27 content::BrowserContext* context) { |
27 new gcm::FakeGCMProfileService(Profile::FromBrowserContext(context)); | 28 scoped_ptr<gcm::FakeGCMProfileService> service( |
| 29 new gcm::FakeGCMProfileService(Profile::FromBrowserContext(context))); |
28 service->SetDriverForTesting(new instance_id::FakeGCMDriverForInstanceID()); | 30 service->SetDriverForTesting(new instance_id::FakeGCMDriverForInstanceID()); |
29 return service; | 31 return service.Pass(); |
30 } | 32 } |
31 | 33 |
32 } // namespace | 34 } // namespace |
33 | 35 |
34 class InstanceIDApiTest : public ExtensionApiTest { | 36 class InstanceIDApiTest : public ExtensionApiTest { |
35 public: | 37 public: |
36 InstanceIDApiTest(); | 38 InstanceIDApiTest(); |
37 | 39 |
38 protected: | 40 protected: |
39 void SetUpOnMainThread() override; | 41 void SetUpOnMainThread() override; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ASSERT_TRUE(RunExtensionTest("instance_id/channel")); | 105 ASSERT_TRUE(RunExtensionTest("instance_id/channel")); |
104 } | 106 } |
105 | 107 |
106 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, StableChannel) { | 108 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, StableChannel) { |
107 extensions::ScopedCurrentChannel current_channel_override( | 109 extensions::ScopedCurrentChannel current_channel_override( |
108 chrome::VersionInfo::CHANNEL_STABLE); | 110 chrome::VersionInfo::CHANNEL_STABLE); |
109 ASSERT_TRUE(RunExtensionTest("instance_id/channel")); | 111 ASSERT_TRUE(RunExtensionTest("instance_id/channel")); |
110 } | 112 } |
111 | 113 |
112 } // namespace extensions | 114 } // namespace extensions |
OLD | NEW |