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