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