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

Side by Side Diff: components/update_client/update_checker_unittest.cc

Issue 2102083002: Allow component installers to specify a map of installer attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/update_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/update_client/update_checker.h" 5 #include "components/update_client/update_checker.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return crx_update_item; 163 return crx_update_item;
164 } 164 }
165 165
166 TEST_F(UpdateCheckerTest, UpdateCheckSuccess) { 166 TEST_F(UpdateCheckerTest, UpdateCheckSuccess) {
167 EXPECT_TRUE(post_interceptor_->ExpectRequest( 167 EXPECT_TRUE(post_interceptor_->ExpectRequest(
168 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); 168 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml")));
169 169
170 update_checker_ = UpdateChecker::Create(config_, metadata_.get()); 170 update_checker_ = UpdateChecker::Create(config_, metadata_.get());
171 171
172 CrxUpdateItem item(BuildCrxUpdateItem()); 172 CrxUpdateItem item(BuildCrxUpdateItem());
173 item.component.ap = "some_ap"; 173 item.component.installer_attributes["ap"] = "some_ap";
174 std::vector<CrxUpdateItem*> items_to_check; 174 std::vector<CrxUpdateItem*> items_to_check;
175 items_to_check.push_back(&item); 175 items_to_check.push_back(&item);
176 176
177 update_checker_->CheckForUpdates( 177 update_checker_->CheckForUpdates(
178 items_to_check, "extra=\"params\"", 178 items_to_check, "extra=\"params\"",
179 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, 179 base::Bind(&UpdateCheckerTest::UpdateCheckComplete,
180 base::Unretained(this))); 180 base::Unretained(this)));
181 181
182 RunThreads(); 182 RunThreads();
183 183
(...skipping 29 matching lines...) Expand all
213 } 213 }
214 214
215 // Tests that an invalid "ap" is not serialized. 215 // Tests that an invalid "ap" is not serialized.
216 TEST_F(UpdateCheckerTest, UpdateCheckInvalidAp) { 216 TEST_F(UpdateCheckerTest, UpdateCheckInvalidAp) {
217 EXPECT_TRUE(post_interceptor_->ExpectRequest( 217 EXPECT_TRUE(post_interceptor_->ExpectRequest(
218 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); 218 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml")));
219 219
220 update_checker_ = UpdateChecker::Create(config_, metadata_.get()); 220 update_checker_ = UpdateChecker::Create(config_, metadata_.get());
221 221
222 CrxUpdateItem item(BuildCrxUpdateItem()); 222 CrxUpdateItem item(BuildCrxUpdateItem());
223 item.component.ap = std::string(257, 'a'); // Too long. 223 // Make "ap" too long.
224 item.component.installer_attributes["ap"] = std::string(257, 'a');
224 std::vector<CrxUpdateItem*> items_to_check; 225 std::vector<CrxUpdateItem*> items_to_check;
225 items_to_check.push_back(&item); 226 items_to_check.push_back(&item);
226 227
227 update_checker_->CheckForUpdates( 228 update_checker_->CheckForUpdates(
228 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, 229 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete,
229 base::Unretained(this))); 230 base::Unretained(this)));
230 231
231 RunThreads(); 232 RunThreads();
232 233
233 EXPECT_NE( 234 EXPECT_NE(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 << post_interceptor_->GetRequestsAsString(); 409 << post_interceptor_->GetRequestsAsString();
409 ASSERT_EQ(2, post_interceptor_->GetCount()) 410 ASSERT_EQ(2, post_interceptor_->GetCount())
410 << post_interceptor_->GetRequestsAsString(); 411 << post_interceptor_->GetRequestsAsString();
411 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( 412 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find(
412 "<ping rd=\"-2\" ping_freshness=")); 413 "<ping rd=\"-2\" ping_freshness="));
413 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[1].find( 414 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[1].find(
414 "<ping rd=\"3383\" ping_freshness=")); 415 "<ping rd=\"3383\" ping_freshness="));
415 } 416 }
416 417
417 } // namespace update_client 418 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/update_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698