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 <memory> |
5 #include <utility> | 6 #include <utility> |
6 | 7 |
7 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h" | 11 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h" |
12 #include "chrome/browser/extensions/extension_apitest.h" | 12 #include "chrome/browser/extensions/extension_apitest.h" |
13 #include "chrome/browser/extensions/extension_gcm_app_handler.h" | 13 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | 15 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
17 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_fa
ctory.h" | 17 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_fa
ctory.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
19 #include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h" | 19 #include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h" |
20 #include "components/version_info/version_info.h" | 20 #include "components/version_info/version_info.h" |
21 #include "extensions/test/result_catcher.h" | 21 #include "extensions/test/result_catcher.h" |
22 | 22 |
23 using extensions::ResultCatcher; | 23 using extensions::ResultCatcher; |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 scoped_ptr<KeyedService> BuildFakeGCMProfileService( | 29 std::unique_ptr<KeyedService> BuildFakeGCMProfileService( |
30 content::BrowserContext* context) { | 30 content::BrowserContext* context) { |
31 scoped_ptr<gcm::FakeGCMProfileService> service( | 31 std::unique_ptr<gcm::FakeGCMProfileService> service( |
32 new gcm::FakeGCMProfileService(Profile::FromBrowserContext(context))); | 32 new gcm::FakeGCMProfileService(Profile::FromBrowserContext(context))); |
33 service->SetDriverForTesting(new instance_id::FakeGCMDriverForInstanceID()); | 33 service->SetDriverForTesting(new instance_id::FakeGCMDriverForInstanceID()); |
34 return std::move(service); | 34 return std::move(service); |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 class InstanceIDApiTest : public ExtensionApiTest { | 39 class InstanceIDApiTest : public ExtensionApiTest { |
40 public: | 40 public: |
41 InstanceIDApiTest(); | 41 InstanceIDApiTest(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 incognito_catcher.RestrictToBrowserContext( | 93 incognito_catcher.RestrictToBrowserContext( |
94 profile()->GetOffTheRecordProfile()); | 94 profile()->GetOffTheRecordProfile()); |
95 | 95 |
96 ASSERT_TRUE(RunExtensionTestIncognito("instance_id/incognito")); | 96 ASSERT_TRUE(RunExtensionTestIncognito("instance_id/incognito")); |
97 | 97 |
98 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 98 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
99 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); | 99 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); |
100 } | 100 } |
101 | 101 |
102 } // namespace extensions | 102 } // namespace extensions |
OLD | NEW |