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

Side by Side Diff: chrome/browser/component_updater/test/component_updater_service_unittest.cc

Issue 763833003: Remove using namespace in net/quic/quic_stream_sequencer.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/component_updater/test/component_updater_service_unitte st.h" 5 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h"
6 6
7 #include <string>
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/values.h" 17 #include "base/values.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 190 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
190 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); 191 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count());
191 192
192 // Expect to see the two update check requests and no other requests, 193 // Expect to see the two update check requests and no other requests,
193 // including pings. 194 // including pings.
194 EXPECT_EQ(2, post_interceptor_->GetHitCount()) 195 EXPECT_EQ(2, post_interceptor_->GetHitCount())
195 << post_interceptor_->GetRequestsAsString(); 196 << post_interceptor_->GetRequestsAsString();
196 EXPECT_EQ(2, post_interceptor_->GetCount()) 197 EXPECT_EQ(2, post_interceptor_->GetCount())
197 << post_interceptor_->GetRequestsAsString(); 198 << post_interceptor_->GetRequestsAsString();
198 EXPECT_NE( 199 EXPECT_NE(
199 string::npos, 200 std::string::npos,
200 post_interceptor_->GetRequests()[0].find( 201 post_interceptor_->GetRequests()[0].find(
201 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">" 202 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">"
202 "<updatecheck /></app>")) 203 "<updatecheck /></app>"))
203 << post_interceptor_->GetRequestsAsString(); 204 << post_interceptor_->GetRequestsAsString();
204 EXPECT_NE( 205 EXPECT_NE(
205 string::npos, 206 std::string::npos,
206 post_interceptor_->GetRequests()[1].find( 207 post_interceptor_->GetRequests()[1].find(
207 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">" 208 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">"
208 "<updatecheck /></app>")) 209 "<updatecheck /></app>"))
209 << post_interceptor_->GetRequestsAsString(); 210 << post_interceptor_->GetRequestsAsString();
210 211
211 component_updater()->Stop(); 212 component_updater()->Stop();
212 213
213 // Loop twice again but this case we simulate a server error by returning 214 // Loop twice again but this case we simulate a server error by returning
214 // an empty file. Expect the behavior of the service to be the same as before. 215 // an empty file. Expect the behavior of the service to be the same as before.
215 EXPECT_CALL(observer, OnEvent(ServiceObserver::COMPONENT_UPDATER_STARTED, "")) 216 EXPECT_CALL(observer, OnEvent(ServiceObserver::COMPONENT_UPDATER_STARTED, ""))
(...skipping 17 matching lines...) Expand all
233 RunThreads(); 234 RunThreads();
234 235
235 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 236 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
236 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); 237 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count());
237 238
238 EXPECT_EQ(2, post_interceptor_->GetHitCount()) 239 EXPECT_EQ(2, post_interceptor_->GetHitCount())
239 << post_interceptor_->GetRequestsAsString(); 240 << post_interceptor_->GetRequestsAsString();
240 EXPECT_EQ(2, post_interceptor_->GetCount()) 241 EXPECT_EQ(2, post_interceptor_->GetCount())
241 << post_interceptor_->GetRequestsAsString(); 242 << post_interceptor_->GetRequestsAsString();
242 EXPECT_NE( 243 EXPECT_NE(
243 string::npos, 244 std::string::npos,
244 post_interceptor_->GetRequests()[0].find( 245 post_interceptor_->GetRequests()[0].find(
245 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">" 246 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">"
246 "<updatecheck /></app>")) 247 "<updatecheck /></app>"))
247 << post_interceptor_->GetRequestsAsString(); 248 << post_interceptor_->GetRequestsAsString();
248 EXPECT_NE( 249 EXPECT_NE(
249 string::npos, 250 std::string::npos,
250 post_interceptor_->GetRequests()[1].find( 251 post_interceptor_->GetRequests()[1].find(
251 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">" 252 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"1.1\">"
252 "<updatecheck /></app>")) 253 "<updatecheck /></app>"))
253 << post_interceptor_->GetRequestsAsString(); 254 << post_interceptor_->GetRequestsAsString();
254 255
255 component_updater()->Stop(); 256 component_updater()->Stop();
256 } 257 }
257 258
258 // Verify that we can check for updates and install one component. Besides 259 // Verify that we can check for updates and install one component. Besides
259 // the notifications above COMPONENT_UPDATE_FOUND and COMPONENT_UPDATE_READY 260 // the notifications above COMPONENT_UPDATE_FOUND and COMPONENT_UPDATE_READY
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // Expect three request in total: two update checks and one ping. 339 // Expect three request in total: two update checks and one ping.
339 EXPECT_EQ(3, post_interceptor_->GetHitCount()) 340 EXPECT_EQ(3, post_interceptor_->GetHitCount())
340 << post_interceptor_->GetRequestsAsString(); 341 << post_interceptor_->GetRequestsAsString();
341 EXPECT_EQ(3, post_interceptor_->GetCount()) 342 EXPECT_EQ(3, post_interceptor_->GetCount())
342 << post_interceptor_->GetRequestsAsString(); 343 << post_interceptor_->GetRequestsAsString();
343 344
344 // Expect one component download. 345 // Expect one component download.
345 EXPECT_EQ(1, get_interceptor_->GetHitCount()); 346 EXPECT_EQ(1, get_interceptor_->GetHitCount());
346 347
347 EXPECT_NE( 348 EXPECT_NE(
348 string::npos, 349 std::string::npos,
349 post_interceptor_->GetRequests()[0].find( 350 post_interceptor_->GetRequests()[0].find(
350 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" 351 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
351 "<updatecheck /></app>")) 352 "<updatecheck /></app>"))
352 << post_interceptor_->GetRequestsAsString(); 353 << post_interceptor_->GetRequestsAsString();
353 EXPECT_NE( 354 EXPECT_NE(
354 string::npos, 355 std::string::npos,
355 post_interceptor_->GetRequests()[0].find( 356 post_interceptor_->GetRequests()[0].find(
356 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">" 357 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">"
357 "<updatecheck /></app>")) 358 "<updatecheck /></app>"))
358 << post_interceptor_->GetRequestsAsString(); 359 << post_interceptor_->GetRequestsAsString();
359 360
360 EXPECT_NE( 361 EXPECT_NE(
361 string::npos, 362 std::string::npos,
362 post_interceptor_->GetRequests()[1].find( 363 post_interceptor_->GetRequests()[1].find(
363 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" " 364 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" "
364 "version=\"0.9\" nextversion=\"1.0\">" 365 "version=\"0.9\" nextversion=\"1.0\">"
365 "<event eventtype=\"3\" eventresult=\"1\"/>")) 366 "<event eventtype=\"3\" eventresult=\"1\"/>"))
366 << post_interceptor_->GetRequestsAsString(); 367 << post_interceptor_->GetRequestsAsString();
367 368
368 EXPECT_NE( 369 EXPECT_NE(
369 string::npos, 370 std::string::npos,
370 post_interceptor_->GetRequests()[2].find( 371 post_interceptor_->GetRequests()[2].find(
371 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"1.0\">" 372 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"1.0\">"
372 "<updatecheck /></app>")); 373 "<updatecheck /></app>"));
373 EXPECT_NE( 374 EXPECT_NE(
374 string::npos, 375 std::string::npos,
375 post_interceptor_->GetRequests()[2].find( 376 post_interceptor_->GetRequests()[2].find(
376 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">" 377 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">"
377 "<updatecheck /></app>")) 378 "<updatecheck /></app>"))
378 << post_interceptor_->GetRequestsAsString(); 379 << post_interceptor_->GetRequestsAsString();
379 380
380 // Test the protocol version is correct and the extra request attributes 381 // Test the protocol version is correct and the extra request attributes
381 // are included in the request. 382 // are included in the request.
382 EXPECT_NE( 383 EXPECT_NE(
383 string::npos, 384 std::string::npos,
384 post_interceptor_->GetRequests()[0].find( 385 post_interceptor_->GetRequests()[0].find(
385 "request protocol=\"3.0\" extra=\"foo\"")) 386 "request protocol=\"3.0\" extra=\"foo\""))
386 << post_interceptor_->GetRequestsAsString(); 387 << post_interceptor_->GetRequestsAsString();
387 388
388 // Tokenize the request string to look for specific attributes, which 389 // Tokenize the request string to look for specific attributes, which
389 // are important for backward compatibility with the version v2 of the update 390 // are important for backward compatibility with the version v2 of the update
390 // protocol. In this case, inspect the <request>, which is the first element 391 // protocol. In this case, inspect the <request>, which is the first element
391 // after the xml declaration of the update request body. 392 // after the xml declaration of the update request body.
392 // Expect to find the |os|, |arch|, |prodchannel|, and |prodversion| 393 // Expect to find the |os|, |arch|, |prodchannel|, and |prodversion|
393 // attributes: 394 // attributes:
394 // <?xml version="1.0" encoding="UTF-8"?> 395 // <?xml version="1.0" encoding="UTF-8"?>
395 // <request... os=... arch=... prodchannel=... prodversion=...> 396 // <request... os=... arch=... prodchannel=... prodversion=...>
396 // ... 397 // ...
397 // </request> 398 // </request>
398 const std::string update_request(post_interceptor_->GetRequests()[0]); 399 const std::string update_request(post_interceptor_->GetRequests()[0]);
399 std::vector<base::StringPiece> elements; 400 std::vector<base::StringPiece> elements;
400 Tokenize(update_request, "<>", &elements); 401 Tokenize(update_request, "<>", &elements);
401 EXPECT_NE(string::npos, elements[1].find(" os=")); 402 EXPECT_NE(std::string::npos, elements[1].find(" os="));
402 EXPECT_NE(string::npos, elements[1].find(" arch=")); 403 EXPECT_NE(std::string::npos, elements[1].find(" arch="));
403 EXPECT_NE(string::npos, elements[1].find(" prodchannel=")); 404 EXPECT_NE(std::string::npos, elements[1].find(" prodchannel="));
404 EXPECT_NE(string::npos, elements[1].find(" prodversion=")); 405 EXPECT_NE(std::string::npos, elements[1].find(" prodversion="));
405 406
406 // Look for additional attributes of the request, such as |version|, 407 // Look for additional attributes of the request, such as |version|,
407 // |requestid|, |lang|, and |nacl_arch|. 408 // |requestid|, |lang|, and |nacl_arch|.
408 EXPECT_NE(string::npos, elements[1].find(" version=")); 409 EXPECT_NE(std::string::npos, elements[1].find(" version="));
409 EXPECT_NE(string::npos, elements[1].find(" requestid=")); 410 EXPECT_NE(std::string::npos, elements[1].find(" requestid="));
410 EXPECT_NE(string::npos, elements[1].find(" lang=")); 411 EXPECT_NE(std::string::npos, elements[1].find(" lang="));
411 EXPECT_NE(string::npos, elements[1].find(" nacl_arch=")); 412 EXPECT_NE(std::string::npos, elements[1].find(" nacl_arch="));
412 413
413 component_updater()->Stop(); 414 component_updater()->Stop();
414 } 415 }
415 416
416 // This test checks that the "prodversionmin" value is handled correctly. In 417 // This test checks that the "prodversionmin" value is handled correctly. In
417 // particular there should not be an install because the minimum product 418 // particular there should not be an install because the minimum product
418 // version is much higher than of chrome. 419 // version is much higher than of chrome.
419 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { 420 TEST_F(ComponentUpdaterTest, ProdVersionCheck) {
420 EXPECT_TRUE(post_interceptor_->ExpectRequest( 421 EXPECT_TRUE(post_interceptor_->ExpectRequest(
421 new PartialMatch("updatecheck"), test_file("updatecheck_reply_2.xml"))); 422 new PartialMatch("updatecheck"), test_file("updatecheck_reply_2.xml")));
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 EXPECT_EQ(2, post_interceptor_->GetHitCount()) 556 EXPECT_EQ(2, post_interceptor_->GetHitCount())
556 << post_interceptor_->GetRequestsAsString(); 557 << post_interceptor_->GetRequestsAsString();
557 EXPECT_EQ(2, post_interceptor_->GetCount()) 558 EXPECT_EQ(2, post_interceptor_->GetCount())
558 << post_interceptor_->GetRequestsAsString(); 559 << post_interceptor_->GetRequestsAsString();
559 560
560 EXPECT_EQ(1, get_interceptor_->GetHitCount()); 561 EXPECT_EQ(1, get_interceptor_->GetHitCount());
561 562
562 // Expect the update check to contain an "ondemand" request for the 563 // Expect the update check to contain an "ondemand" request for the
563 // second component (com2) and a normal request for the other component. 564 // second component (com2) and a normal request for the other component.
564 EXPECT_NE( 565 EXPECT_NE(
565 string::npos, 566 std::string::npos,
566 post_interceptor_->GetRequests()[0].find( 567 post_interceptor_->GetRequests()[0].find(
567 "<app appid=\"abagagagagagagagagagagagagagagag\" " 568 "<app appid=\"abagagagagagagagagagagagagagagag\" "
568 "version=\"2.2\"><updatecheck /></app>")) 569 "version=\"2.2\"><updatecheck /></app>"))
569 << post_interceptor_->GetRequestsAsString(); 570 << post_interceptor_->GetRequestsAsString();
570 EXPECT_NE( 571 EXPECT_NE(
571 string::npos, 572 std::string::npos,
572 post_interceptor_->GetRequests()[0].find( 573 post_interceptor_->GetRequests()[0].find(
573 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" " 574 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" "
574 "version=\"0.9\" installsource=\"ondemand\"><updatecheck /></app>")) 575 "version=\"0.9\" installsource=\"ondemand\"><updatecheck /></app>"))
575 << post_interceptor_->GetRequestsAsString(); 576 << post_interceptor_->GetRequestsAsString();
576 EXPECT_NE( 577 EXPECT_NE(
577 string::npos, 578 std::string::npos,
578 post_interceptor_->GetRequests()[1].find( 579 post_interceptor_->GetRequests()[1].find(
579 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" " 580 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" "
580 "version=\"0.9\" nextversion=\"1.0\">" 581 "version=\"0.9\" nextversion=\"1.0\">"
581 "<event eventtype=\"3\" eventresult=\"1\"/>")) 582 "<event eventtype=\"3\" eventresult=\"1\"/>"))
582 << post_interceptor_->GetRequestsAsString(); 583 << post_interceptor_->GetRequestsAsString();
583 584
584 // Also check what happens if previous check too soon. It works, since this 585 // Also check what happens if previous check too soon. It works, since this
585 // direct OnDemand call does not implement a cooldown. 586 // direct OnDemand call does not implement a cooldown.
586 test_configurator()->SetOnDemandTime(60 * 60); 587 test_configurator()->SetOnDemandTime(60 * 60);
587 EXPECT_EQ( 588 EXPECT_EQ(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); 743 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error());
743 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); 744 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count());
744 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); 745 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error());
745 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count()); 746 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count());
746 747
747 EXPECT_EQ(3, post_interceptor_->GetHitCount()) 748 EXPECT_EQ(3, post_interceptor_->GetHitCount())
748 << post_interceptor_->GetRequestsAsString(); 749 << post_interceptor_->GetRequestsAsString();
749 EXPECT_EQ(1, get_interceptor_->GetHitCount()); 750 EXPECT_EQ(1, get_interceptor_->GetHitCount());
750 751
751 EXPECT_NE( 752 EXPECT_NE(
752 string::npos, 753 std::string::npos,
753 post_interceptor_->GetRequests()[0].find( 754 post_interceptor_->GetRequests()[0].find(
754 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" 755 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
755 "<updatecheck /></app>")) 756 "<updatecheck /></app>"))
756 << post_interceptor_->GetRequestsAsString(); 757 << post_interceptor_->GetRequestsAsString();
757 EXPECT_NE( 758 EXPECT_NE(
758 string::npos, 759 std::string::npos,
759 post_interceptor_->GetRequests()[1].find( 760 post_interceptor_->GetRequests()[1].find(
760 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" " 761 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" "
761 "version=\"0.9\" nextversion=\"1.0\">" 762 "version=\"0.9\" nextversion=\"1.0\">"
762 "<event eventtype=\"3\" eventresult=\"1\"/>")) 763 "<event eventtype=\"3\" eventresult=\"1\"/>"))
763 << post_interceptor_->GetRequestsAsString(); 764 << post_interceptor_->GetRequestsAsString();
764 EXPECT_NE( 765 EXPECT_NE(
765 string::npos, 766 std::string::npos,
766 post_interceptor_->GetRequests()[2].find( 767 post_interceptor_->GetRequests()[2].find(
767 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"1.0\">" 768 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"1.0\">"
768 "<updatecheck /></app>")) 769 "<updatecheck /></app>"))
769 << post_interceptor_->GetRequestsAsString(); 770 << post_interceptor_->GetRequestsAsString();
770 771
771 component_updater()->Stop(); 772 component_updater()->Stop();
772 773
773 // Now re-register, pretending to be an even newer version (2.2) 774 // Now re-register, pretending to be an even newer version (2.2)
774 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&observer)); 775 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&observer));
775 { 776 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); 811 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error());
811 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count()); 812 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count());
812 813
813 // One update check and no additional pings are expected. 814 // One update check and no additional pings are expected.
814 EXPECT_EQ(1, post_interceptor_->GetHitCount()) 815 EXPECT_EQ(1, post_interceptor_->GetHitCount())
815 << post_interceptor_->GetRequestsAsString(); 816 << post_interceptor_->GetRequestsAsString();
816 EXPECT_EQ(1, post_interceptor_->GetCount()) 817 EXPECT_EQ(1, post_interceptor_->GetCount())
817 << post_interceptor_->GetRequestsAsString(); 818 << post_interceptor_->GetRequestsAsString();
818 819
819 EXPECT_NE( 820 EXPECT_NE(
820 string::npos, 821 std::string::npos,
821 post_interceptor_->GetRequests()[0].find( 822 post_interceptor_->GetRequests()[0].find(
822 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"2.2\">" 823 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"2.2\">"
823 "<updatecheck /></app>")); 824 "<updatecheck /></app>"));
824 825
825 component_updater()->Stop(); 826 component_updater()->Stop();
826 } 827 }
827 828
828 // Verify that we can download and install a component and a differential 829 // Verify that we can download and install a component and a differential
829 // update to that component. We do three loops; the final loop should do 830 // update to that component. We do three loops; the final loop should do
830 // nothing. 831 // nothing.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 869 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
869 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); 870 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count());
870 871
871 EXPECT_EQ(5, post_interceptor_->GetHitCount()) 872 EXPECT_EQ(5, post_interceptor_->GetHitCount())
872 << post_interceptor_->GetRequestsAsString(); 873 << post_interceptor_->GetRequestsAsString();
873 EXPECT_EQ(5, post_interceptor_->GetCount()) 874 EXPECT_EQ(5, post_interceptor_->GetCount())
874 << post_interceptor_->GetRequestsAsString(); 875 << post_interceptor_->GetRequestsAsString();
875 EXPECT_EQ(2, get_interceptor_->GetHitCount()); 876 EXPECT_EQ(2, get_interceptor_->GetHitCount());
876 877
877 EXPECT_NE( 878 EXPECT_NE(
878 string::npos, 879 std::string::npos,
879 post_interceptor_->GetRequests()[0].find( 880 post_interceptor_->GetRequests()[0].find(
880 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"0.0\">" 881 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"0.0\">"
881 "<updatecheck /></app>")) 882 "<updatecheck /></app>"))
882 << post_interceptor_->GetRequestsAsString(); 883 << post_interceptor_->GetRequestsAsString();
883 EXPECT_NE( 884 EXPECT_NE(
884 string::npos, 885 std::string::npos,
885 post_interceptor_->GetRequests()[1].find( 886 post_interceptor_->GetRequests()[1].find(
886 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" " 887 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" "
887 "version=\"0.0\" nextversion=\"1.0\">" 888 "version=\"0.0\" nextversion=\"1.0\">"
888 "<event eventtype=\"3\" eventresult=\"1\" nextfp=\"1\"/>")) 889 "<event eventtype=\"3\" eventresult=\"1\" nextfp=\"1\"/>"))
889 << post_interceptor_->GetRequestsAsString(); 890 << post_interceptor_->GetRequestsAsString();
890 EXPECT_NE( 891 EXPECT_NE(
891 string::npos, 892 std::string::npos,
892 post_interceptor_->GetRequests()[2].find( 893 post_interceptor_->GetRequests()[2].find(
893 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"1.0\">" 894 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"1.0\">"
894 "<updatecheck /><packages><package fp=\"1\"/></packages></app>")) 895 "<updatecheck /><packages><package fp=\"1\"/></packages></app>"))
895 << post_interceptor_->GetRequestsAsString(); 896 << post_interceptor_->GetRequestsAsString();
896 EXPECT_NE( 897 EXPECT_NE(
897 string::npos, 898 std::string::npos,
898 post_interceptor_->GetRequests()[3].find( 899 post_interceptor_->GetRequests()[3].find(
899 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" " 900 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" "
900 "version=\"1.0\" nextversion=\"2.0\">" 901 "version=\"1.0\" nextversion=\"2.0\">"
901 "<event eventtype=\"3\" eventresult=\"1\" diffresult=\"1\" " 902 "<event eventtype=\"3\" eventresult=\"1\" diffresult=\"1\" "
902 "previousfp=\"1\" nextfp=\"22\"/>")) 903 "previousfp=\"1\" nextfp=\"22\"/>"))
903 << post_interceptor_->GetRequestsAsString(); 904 << post_interceptor_->GetRequestsAsString();
904 EXPECT_NE( 905 EXPECT_NE(
905 string::npos, 906 std::string::npos,
906 post_interceptor_->GetRequests()[4].find( 907 post_interceptor_->GetRequests()[4].find(
907 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"2.0\">" 908 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"2.0\">"
908 "<updatecheck /><packages><package fp=\"22\"/></packages></app>")) 909 "<updatecheck /><packages><package fp=\"22\"/></packages></app>"))
909 << post_interceptor_->GetRequestsAsString(); 910 << post_interceptor_->GetRequestsAsString();
910 component_updater()->Stop(); 911 component_updater()->Stop();
911 } 912 }
912 913
913 // Verify that component installation falls back to downloading and installing 914 // Verify that component installation falls back to downloading and installing
914 // a full update if the differential update fails (in this case, because the 915 // a full update if the differential update fails (in this case, because the
915 // installer does not know about the existing files). We do two loops; the final 916 // installer does not know about the existing files). We do two loops; the final
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 959 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
959 EXPECT_EQ(1, static_cast<TestInstaller*>(com.installer)->install_count()); 960 EXPECT_EQ(1, static_cast<TestInstaller*>(com.installer)->install_count());
960 961
961 EXPECT_EQ(3, post_interceptor_->GetHitCount()) 962 EXPECT_EQ(3, post_interceptor_->GetHitCount())
962 << post_interceptor_->GetRequestsAsString(); 963 << post_interceptor_->GetRequestsAsString();
963 EXPECT_EQ(3, post_interceptor_->GetCount()) 964 EXPECT_EQ(3, post_interceptor_->GetCount())
964 << post_interceptor_->GetRequestsAsString(); 965 << post_interceptor_->GetRequestsAsString();
965 EXPECT_EQ(2, get_interceptor_->GetHitCount()); 966 EXPECT_EQ(2, get_interceptor_->GetHitCount());
966 967
967 EXPECT_NE( 968 EXPECT_NE(
968 string::npos, 969 std::string::npos,
969 post_interceptor_->GetRequests()[0].find( 970 post_interceptor_->GetRequests()[0].find(
970 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"1.0\">" 971 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"1.0\">"
971 "<updatecheck /></app>")) 972 "<updatecheck /></app>"))
972 << post_interceptor_->GetRequestsAsString(); 973 << post_interceptor_->GetRequestsAsString();
973 EXPECT_NE( 974 EXPECT_NE(
974 string::npos, 975 std::string::npos,
975 post_interceptor_->GetRequests()[1].find( 976 post_interceptor_->GetRequests()[1].find(
976 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" " 977 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" "
977 "version=\"1.0\" nextversion=\"2.0\">" 978 "version=\"1.0\" nextversion=\"2.0\">"
978 "<event eventtype=\"3\" eventresult=\"1\" diffresult=\"0\" " 979 "<event eventtype=\"3\" eventresult=\"1\" diffresult=\"0\" "
979 "differrorcat=\"2\" differrorcode=\"16\" nextfp=\"22\"/>")) 980 "differrorcat=\"2\" differrorcode=\"16\" nextfp=\"22\"/>"))
980 << post_interceptor_->GetRequestsAsString(); 981 << post_interceptor_->GetRequestsAsString();
981 EXPECT_NE( 982 EXPECT_NE(
982 string::npos, 983 std::string::npos,
983 post_interceptor_->GetRequests()[2].find( 984 post_interceptor_->GetRequests()[2].find(
984 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"2.0\">" 985 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"2.0\">"
985 "<updatecheck /><packages><package fp=\"22\"/></packages></app>")) 986 "<updatecheck /><packages><package fp=\"22\"/></packages></app>"))
986 << post_interceptor_->GetRequestsAsString(); 987 << post_interceptor_->GetRequestsAsString();
987 988
988 component_updater()->Stop(); 989 component_updater()->Stop();
989 } 990 }
990 991
991 // Test is flakey on Android bots. See crbug.com/331420. 992 // Test is flakey on Android bots. See crbug.com/331420.
992 #if defined(OS_ANDROID) 993 #if defined(OS_ANDROID)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1025
1025 test_configurator()->SetLoopCount(2); 1026 test_configurator()->SetLoopCount(2);
1026 component_updater()->Start(); 1027 component_updater()->Start();
1027 RunThreads(); 1028 RunThreads();
1028 1029
1029 EXPECT_EQ(4, post_interceptor_->GetHitCount()) 1030 EXPECT_EQ(4, post_interceptor_->GetHitCount())
1030 << post_interceptor_->GetRequestsAsString(); 1031 << post_interceptor_->GetRequestsAsString();
1031 EXPECT_EQ(2, get_interceptor_->GetHitCount()); 1032 EXPECT_EQ(2, get_interceptor_->GetHitCount());
1032 1033
1033 EXPECT_NE( 1034 EXPECT_NE(
1034 string::npos, 1035 std::string::npos,
1035 post_interceptor_->GetRequests()[0].find( 1036 post_interceptor_->GetRequests()[0].find(
1036 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" 1037 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
1037 "<updatecheck /></app>")) 1038 "<updatecheck /></app>"))
1038 << post_interceptor_->GetRequestsAsString(); 1039 << post_interceptor_->GetRequestsAsString();
1039 EXPECT_NE( 1040 EXPECT_NE(
1040 string::npos, 1041 std::string::npos,
1041 post_interceptor_->GetRequests()[1].find( 1042 post_interceptor_->GetRequests()[1].find(
1042 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" " 1043 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" "
1043 "version=\"0.9\" nextversion=\"1.0\">" 1044 "version=\"0.9\" nextversion=\"1.0\">"
1044 "<event eventtype=\"3\" eventresult=\"0\" " 1045 "<event eventtype=\"3\" eventresult=\"0\" "
1045 "errorcat=\"3\" errorcode=\"9\"/>")) 1046 "errorcat=\"3\" errorcode=\"9\"/>"))
1046 << post_interceptor_->GetRequestsAsString(); 1047 << post_interceptor_->GetRequestsAsString();
1047 EXPECT_NE( 1048 EXPECT_NE(
1048 string::npos, 1049 std::string::npos,
1049 post_interceptor_->GetRequests()[2].find( 1050 post_interceptor_->GetRequests()[2].find(
1050 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" 1051 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
1051 "<updatecheck /></app>")) 1052 "<updatecheck /></app>"))
1052 << post_interceptor_->GetRequestsAsString(); 1053 << post_interceptor_->GetRequestsAsString();
1053 EXPECT_NE( 1054 EXPECT_NE(
1054 string::npos, 1055 std::string::npos,
1055 post_interceptor_->GetRequests()[3].find( 1056 post_interceptor_->GetRequests()[3].find(
1056 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" " 1057 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" "
1057 "version=\"0.9\" nextversion=\"1.0\">" 1058 "version=\"0.9\" nextversion=\"1.0\">"
1058 "<event eventtype=\"3\" eventresult=\"0\" " 1059 "<event eventtype=\"3\" eventresult=\"0\" "
1059 "errorcat=\"3\" errorcode=\"9\"/>")) 1060 "errorcat=\"3\" errorcode=\"9\"/>"))
1060 << post_interceptor_->GetRequestsAsString(); 1061 << post_interceptor_->GetRequestsAsString();
1061 1062
1062 // Loop once more, but expect no ping because a noupdate response is issued. 1063 // Loop once more, but expect no ping because a noupdate response is issued.
1063 // This is necessary to clear out the fire-and-forget ping from the previous 1064 // This is necessary to clear out the fire-and-forget ping from the previous
1064 // iteration. 1065 // iteration.
1065 post_interceptor_->Reset(); 1066 post_interceptor_->Reset();
1066 EXPECT_TRUE(post_interceptor_->ExpectRequest( 1067 EXPECT_TRUE(post_interceptor_->ExpectRequest(
1067 new PartialMatch("updatecheck"), 1068 new PartialMatch("updatecheck"),
1068 test_file("updatecheck_reply_noupdate.xml"))); 1069 test_file("updatecheck_reply_noupdate.xml")));
1069 1070
1070 test_configurator()->SetLoopCount(1); 1071 test_configurator()->SetLoopCount(1);
1071 component_updater()->Start(); 1072 component_updater()->Start();
1072 RunThreads(); 1073 RunThreads();
1073 1074
1074 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 1075 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
1075 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); 1076 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count());
1076 1077
1077 EXPECT_EQ(1, post_interceptor_->GetHitCount()) 1078 EXPECT_EQ(1, post_interceptor_->GetHitCount())
1078 << post_interceptor_->GetRequestsAsString(); 1079 << post_interceptor_->GetRequestsAsString();
1079 EXPECT_EQ(1, post_interceptor_->GetCount()) 1080 EXPECT_EQ(1, post_interceptor_->GetCount())
1080 << post_interceptor_->GetRequestsAsString(); 1081 << post_interceptor_->GetRequestsAsString();
1081 1082
1082 EXPECT_NE( 1083 EXPECT_NE(
1083 string::npos, 1084 std::string::npos,
1084 post_interceptor_->GetRequests()[0].find( 1085 post_interceptor_->GetRequests()[0].find(
1085 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" 1086 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
1086 "<updatecheck /></app>")) 1087 "<updatecheck /></app>"))
1087 << post_interceptor_->GetRequestsAsString(); 1088 << post_interceptor_->GetRequestsAsString();
1088 1089
1089 component_updater()->Stop(); 1090 component_updater()->Stop();
1090 } 1091 }
1091 1092
1092 // Verify that we successfully propagate a patcher error. 1093 // Verify that we successfully propagate a patcher error.
1093 // ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx contains an incorrect 1094 // ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx contains an incorrect
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 1133 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
1133 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); 1134 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count());
1134 1135
1135 EXPECT_EQ(5, post_interceptor_->GetHitCount()) 1136 EXPECT_EQ(5, post_interceptor_->GetHitCount())
1136 << post_interceptor_->GetRequestsAsString(); 1137 << post_interceptor_->GetRequestsAsString();
1137 EXPECT_EQ(5, post_interceptor_->GetCount()) 1138 EXPECT_EQ(5, post_interceptor_->GetCount())
1138 << post_interceptor_->GetRequestsAsString(); 1139 << post_interceptor_->GetRequestsAsString();
1139 EXPECT_EQ(3, get_interceptor_->GetHitCount()); 1140 EXPECT_EQ(3, get_interceptor_->GetHitCount());
1140 1141
1141 EXPECT_NE( 1142 EXPECT_NE(
1142 string::npos, 1143 std::string::npos,
1143 post_interceptor_->GetRequests()[0].find( 1144 post_interceptor_->GetRequests()[0].find(
1144 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"0.0\">" 1145 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"0.0\">"
1145 "<updatecheck /></app>")) 1146 "<updatecheck /></app>"))
1146 << post_interceptor_->GetRequestsAsString(); 1147 << post_interceptor_->GetRequestsAsString();
1147 EXPECT_NE( 1148 EXPECT_NE(
1148 string::npos, 1149 std::string::npos,
1149 post_interceptor_->GetRequests()[1].find( 1150 post_interceptor_->GetRequests()[1].find(
1150 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" " 1151 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" "
1151 "version=\"0.0\" nextversion=\"1.0\">" 1152 "version=\"0.0\" nextversion=\"1.0\">"
1152 "<event eventtype=\"3\" eventresult=\"1\" nextfp=\"1\"/>")) 1153 "<event eventtype=\"3\" eventresult=\"1\" nextfp=\"1\"/>"))
1153 << post_interceptor_->GetRequestsAsString(); 1154 << post_interceptor_->GetRequestsAsString();
1154 EXPECT_NE( 1155 EXPECT_NE(
1155 string::npos, 1156 std::string::npos,
1156 post_interceptor_->GetRequests()[2].find( 1157 post_interceptor_->GetRequests()[2].find(
1157 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"1.0\">" 1158 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"1.0\">"
1158 "<updatecheck /><packages><package fp=\"1\"/></packages></app>")) 1159 "<updatecheck /><packages><package fp=\"1\"/></packages></app>"))
1159 << post_interceptor_->GetRequestsAsString(); 1160 << post_interceptor_->GetRequestsAsString();
1160 EXPECT_NE( 1161 EXPECT_NE(
1161 string::npos, 1162 std::string::npos,
1162 post_interceptor_->GetRequests()[3].find( 1163 post_interceptor_->GetRequests()[3].find(
1163 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" " 1164 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" "
1164 "version=\"1.0\" nextversion=\"2.0\">" 1165 "version=\"1.0\" nextversion=\"2.0\">"
1165 "<event eventtype=\"3\" eventresult=\"1\" " 1166 "<event eventtype=\"3\" eventresult=\"1\" "
1166 "diffresult=\"0\" differrorcat=\"2\" " 1167 "diffresult=\"0\" differrorcat=\"2\" "
1167 "differrorcode=\"14\" diffextracode1=\"305\" " 1168 "differrorcode=\"14\" diffextracode1=\"305\" "
1168 "previousfp=\"1\" nextfp=\"22\"/>")) 1169 "previousfp=\"1\" nextfp=\"22\"/>"))
1169 << post_interceptor_->GetRequestsAsString(); 1170 << post_interceptor_->GetRequestsAsString();
1170 EXPECT_NE( 1171 EXPECT_NE(
1171 string::npos, 1172 std::string::npos,
1172 post_interceptor_->GetRequests()[4].find( 1173 post_interceptor_->GetRequests()[4].find(
1173 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"2.0\">" 1174 "<app appid=\"ihfokbkgjpifnbbojhneepfflplebdkc\" version=\"2.0\">"
1174 "<updatecheck /><packages><package fp=\"22\"/></packages></app>")) 1175 "<updatecheck /><packages><package fp=\"22\"/></packages></app>"))
1175 << post_interceptor_->GetRequestsAsString(); 1176 << post_interceptor_->GetRequestsAsString();
1176 } 1177 }
1177 1178
1178 class TestResourceController : public content::ResourceController { 1179 class TestResourceController : public content::ResourceController {
1179 public: 1180 public:
1180 virtual void SetThrottle(content::ResourceThrottle* throttle) {} 1181 virtual void SetThrottle(content::ResourceThrottle* throttle) {}
1181 }; 1182 };
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 component_updater()->RemoveObserver(&observer2); 1490 component_updater()->RemoveObserver(&observer2);
1490 1491
1491 test_configurator()->SetLoopCount(1); 1492 test_configurator()->SetLoopCount(1);
1492 component_updater()->Start(); 1493 component_updater()->Start();
1493 RunThreads(); 1494 RunThreads();
1494 1495
1495 component_updater()->Stop(); 1496 component_updater()->Stop();
1496 } 1497 }
1497 1498
1498 } // namespace component_updater 1499 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/io_thread.h » ('j') | net/quic/congestion_control/send_algorithm_simulator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698