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