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