| 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_client_factory.h" | 10 #include "chrome/browser/services/gcm/gcm_client_factory.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 IN_PROC_BROWSER_TEST_F(GcmApiTest, Register) { | 99 IN_PROC_BROWSER_TEST_F(GcmApiTest, Register) { |
| 100 if (ShouldSkipTest()) | 100 if (ShouldSkipTest()) |
| 101 return; | 101 return; |
| 102 | 102 |
| 103 StartCollecting(); | 103 StartCollecting(); |
| 104 ASSERT_TRUE(RunExtensionTest("gcm/functions/register")); | 104 ASSERT_TRUE(RunExtensionTest("gcm/functions/register")); |
| 105 | 105 |
| 106 // SHA1 of the public key provided in manifest.json. | 106 // SHA1 of the public key provided in manifest.json. |
| 107 EXPECT_EQ("26469186F238EE08FA71C38311C6990F61D40DCA", | 107 EXPECT_EQ("26469186F238EE08FA71C38311C6990F61D40DCA", |
| 108 service()->last_registered_cert()); | 108 service()->last_registered_cert()); |
| 109 const std::vector<std::string>& sender_ids = | 109 EXPECT_EQ("Sender1", service()->last_registered_sender_id()); |
| 110 service()->last_registered_sender_ids(); | |
| 111 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender1") != | |
| 112 sender_ids.end()); | |
| 113 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender2") != | |
| 114 sender_ids.end()); | |
| 115 } | 110 } |
| 116 | 111 |
| 117 IN_PROC_BROWSER_TEST_F(GcmApiTest, RegisterWithoutKey) { | 112 IN_PROC_BROWSER_TEST_F(GcmApiTest, RegisterWithoutKey) { |
| 118 if (ShouldSkipTest()) | 113 if (ShouldSkipTest()) |
| 119 return; | 114 return; |
| 120 | 115 |
| 121 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_without_key")); | 116 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_without_key")); |
| 122 } | 117 } |
| 123 | 118 |
| 124 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendValidation) { | 119 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendValidation) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 ResultCatcher incognito_catcher; | 210 ResultCatcher incognito_catcher; |
| 216 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile()); | 211 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile()); |
| 217 | 212 |
| 218 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); | 213 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); |
| 219 | 214 |
| 220 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 215 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 221 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); | 216 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); |
| 222 } | 217 } |
| 223 | 218 |
| 224 } // namespace extensions | 219 } // namespace extensions |
| OLD | NEW |