OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "chrome/browser/extensions/api/gcm/gcm_api.h" | 6 #include "chrome/browser/extensions/api/gcm/gcm_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | 9 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 GcmApiTest() : fake_gcm_profile_service_(NULL) {} | 24 GcmApiTest() : fake_gcm_profile_service_(NULL) {} |
25 | 25 |
26 protected: | 26 protected: |
27 virtual void SetUp() OVERRIDE; | 27 virtual void SetUp() OVERRIDE; |
28 virtual void SetUpOnMainThread() OVERRIDE; | 28 virtual void SetUpOnMainThread() OVERRIDE; |
29 | 29 |
30 void StartCollecting(); | 30 void StartCollecting(); |
31 | 31 |
32 const Extension* LoadTestExtension(const std::string& extension_path, | 32 const Extension* LoadTestExtension(const std::string& extension_path, |
33 const std::string& page_name); | 33 const std::string& page_name); |
34 | |
35 gcm::FakeGCMProfileService* service() const; | 34 gcm::FakeGCMProfileService* service() const; |
36 | 35 |
37 private: | 36 private: |
38 gcm::FakeGCMProfileService* fake_gcm_profile_service_; | 37 gcm::FakeGCMProfileService* fake_gcm_profile_service_; |
39 }; | 38 }; |
40 | 39 |
41 void GcmApiTest::SetUp() { | 40 void GcmApiTest::SetUp() { |
42 // TODO(jianli): Once the GCM API enters stable, remove |channel|. | 41 // TODO(jianli): Once the GCM API enters stable, remove |channel|. |
43 ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_UNKNOWN); | 42 ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_UNKNOWN); |
44 | 43 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 router.OnSendError(extension->id(), "error_message_3", | 159 router.OnSendError(extension->id(), "error_message_3", |
161 gcm::GCMClient::NETWORK_ERROR); | 160 gcm::GCMClient::NETWORK_ERROR); |
162 router.OnSendError(extension->id(), "error_message_4", | 161 router.OnSendError(extension->id(), "error_message_4", |
163 gcm::GCMClient::UNKNOWN_ERROR); | 162 gcm::GCMClient::UNKNOWN_ERROR); |
164 router.OnSendError(extension->id(), "error_message_5", | 163 router.OnSendError(extension->id(), "error_message_5", |
165 gcm::GCMClient::TTL_EXCEEDED); | 164 gcm::GCMClient::TTL_EXCEEDED); |
166 | 165 |
167 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 166 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
168 } | 167 } |
169 | 168 |
| 169 IN_PROC_BROWSER_TEST_F(GcmApiTest, Incognito) { |
| 170 ResultCatcher catcher; |
| 171 catcher.RestrictToProfile(profile()); |
| 172 ResultCatcher incognito_catcher; |
| 173 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile()); |
| 174 |
| 175 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); |
| 176 |
| 177 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 178 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); |
| 179 } |
| 180 |
170 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |