Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: chrome/browser/extensions/api/gcm/gcm_apitest.cc

Issue 183923006: [GCM] API update to allow only a single sender in registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ResultCatcher incognito_catcher; 205 ResultCatcher incognito_catcher;
211 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile()); 206 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile());
212 207
213 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); 208 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito"));
214 209
215 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 210 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
216 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); 211 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message();
217 } 212 }
218 213
219 } // namespace extensions 214 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698