| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_validation")); | 96 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_validation")); |
| 97 } | 97 } |
| 98 | 98 |
| 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 EXPECT_FALSE(service()->last_registered_cert().empty()); |
| 107 EXPECT_EQ("26469186F238EE08FA71C38311C6990F61D40DCA", | |
| 108 service()->last_registered_cert()); | |
| 109 const std::vector<std::string>& sender_ids = | 107 const std::vector<std::string>& sender_ids = |
| 110 service()->last_registered_sender_ids(); | 108 service()->last_registered_sender_ids(); |
| 111 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender1") != | 109 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender1") != |
| 112 sender_ids.end()); | 110 sender_ids.end()); |
| 113 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender2") != | 111 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender2") != |
| 114 sender_ids.end()); | 112 sender_ids.end()); |
| 115 } | 113 } |
| 116 | 114 |
| 117 IN_PROC_BROWSER_TEST_F(GcmApiTest, RegisterWithoutKey) { | |
| 118 if (ShouldSkipTest()) | |
| 119 return; | |
| 120 | |
| 121 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_without_key")); | |
| 122 } | |
| 123 | |
| 124 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendValidation) { | 115 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendValidation) { |
| 125 if (ShouldSkipTest()) | 116 if (ShouldSkipTest()) |
| 126 return; | 117 return; |
| 127 | 118 |
| 128 ASSERT_TRUE(RunExtensionTest("gcm/functions/send")); | 119 ASSERT_TRUE(RunExtensionTest("gcm/functions/send")); |
| 129 } | 120 } |
| 130 | 121 |
| 131 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendMessageData) { | 122 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendMessageData) { |
| 132 if (ShouldSkipTest()) | 123 if (ShouldSkipTest()) |
| 133 return; | 124 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 ResultCatcher incognito_catcher; | 201 ResultCatcher incognito_catcher; |
| 211 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile()); | 202 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile()); |
| 212 | 203 |
| 213 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); | 204 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); |
| 214 | 205 |
| 215 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 206 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 216 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); | 207 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); |
| 217 } | 208 } |
| 218 | 209 |
| 219 } // namespace extensions | 210 } // namespace extensions |
| OLD | NEW |