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

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

Issue 100543005: Update all users of base::Version to explicitly specify the namespace, and clean up the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: someday it will work Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return test_data_dir_.AppendASCII(file); 202 return test_data_dir_.AppendASCII(file);
203 } 203 }
204 204
205 TestConfigurator* ComponentUpdaterTest::test_configurator() { 205 TestConfigurator* ComponentUpdaterTest::test_configurator() {
206 return test_config_; 206 return test_config_;
207 } 207 }
208 208
209 ComponentUpdateService::Status ComponentUpdaterTest::RegisterComponent( 209 ComponentUpdateService::Status ComponentUpdaterTest::RegisterComponent(
210 CrxComponent* com, 210 CrxComponent* com,
211 TestComponents component, 211 TestComponents component,
212 const Version& version, 212 const base::Version& version,
213 TestInstaller* installer) { 213 TestInstaller* installer) {
214 if (component == kTestComponent_abag) { 214 if (component == kTestComponent_abag) {
215 com->name = "test_abag"; 215 com->name = "test_abag";
216 com->pk_hash.assign(abag_hash, abag_hash + arraysize(abag_hash)); 216 com->pk_hash.assign(abag_hash, abag_hash + arraysize(abag_hash));
217 } else if (component == kTestComponent_jebg) { 217 } else if (component == kTestComponent_jebg) {
218 com->name = "test_jebg"; 218 com->name = "test_jebg";
219 com->pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); 219 com->pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash));
220 } else { 220 } else {
221 com->name = "test_ihfo"; 221 com->name = "test_ihfo";
222 com->pk_hash.assign(ihfo_hash, ihfo_hash + arraysize(ihfo_hash)); 222 com->pk_hash.assign(ihfo_hash, ihfo_hash + arraysize(ihfo_hash));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 281 "updatecheck"), test_file("updatecheck_reply_1.xml")));
282 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 282 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
283 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 283 "updatecheck"), test_file("updatecheck_reply_1.xml")));
284 284
285 TestInstaller installer; 285 TestInstaller installer;
286 CrxComponent com; 286 CrxComponent com;
287 com.observer = &observer; 287 com.observer = &observer;
288 EXPECT_EQ(ComponentUpdateService::kOk, 288 EXPECT_EQ(ComponentUpdateService::kOk,
289 RegisterComponent(&com, 289 RegisterComponent(&com,
290 kTestComponent_abag, 290 kTestComponent_abag,
291 Version("1.1"), 291 base::Version("1.1"),
292 &installer)); 292 &installer));
293 293
294 // We loop twice, but there are no updates so we expect two sleep messages. 294 // We loop twice, but there are no updates so we expect two sleep messages.
295 test_configurator()->SetLoopCount(2); 295 test_configurator()->SetLoopCount(2);
296 component_updater()->Start(); 296 component_updater()->Start();
297 RunThreads(); 297 RunThreads();
298 298
299 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 299 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
300 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); 300 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count());
301 301
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 419 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
420 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 420 "updatecheck"), test_file("updatecheck_reply_1.xml")));
421 421
422 get_interceptor_->SetResponse( 422 get_interceptor_->SetResponse(
423 GURL(expected_crx_url), 423 GURL(expected_crx_url),
424 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); 424 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx"));
425 425
426 TestInstaller installer1; 426 TestInstaller installer1;
427 CrxComponent com1; 427 CrxComponent com1;
428 com1.observer = &observer1; 428 com1.observer = &observer1;
429 RegisterComponent(&com1, kTestComponent_jebg, Version("0.9"), &installer1); 429 RegisterComponent(
430 &com1, kTestComponent_jebg, base::Version("0.9"), &installer1);
430 TestInstaller installer2; 431 TestInstaller installer2;
431 CrxComponent com2; 432 CrxComponent com2;
432 com2.observer = &observer2; 433 com2.observer = &observer2;
433 RegisterComponent(&com2, kTestComponent_abag, Version("2.2"), &installer2); 434 RegisterComponent(
435 &com2, kTestComponent_abag, base::Version("2.2"), &installer2);
434 436
435 test_configurator()->SetLoopCount(2); 437 test_configurator()->SetLoopCount(2);
436 component_updater()->Start(); 438 component_updater()->Start();
437 RunThreads(); 439 RunThreads();
438 440
439 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); 441 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error());
440 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); 442 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count());
441 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); 443 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error());
442 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count()); 444 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count());
443 445
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { 490 TEST_F(ComponentUpdaterTest, ProdVersionCheck) {
489 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 491 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
490 "updatecheck"), test_file("updatecheck_reply_2.xml"))); 492 "updatecheck"), test_file("updatecheck_reply_2.xml")));
491 493
492 get_interceptor_->SetResponse( 494 get_interceptor_->SetResponse(
493 GURL(expected_crx_url), 495 GURL(expected_crx_url),
494 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); 496 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx"));
495 497
496 TestInstaller installer; 498 TestInstaller installer;
497 CrxComponent com; 499 CrxComponent com;
498 RegisterComponent(&com, kTestComponent_jebg, Version("0.9"), &installer); 500 RegisterComponent(
501 &com, kTestComponent_jebg, base::Version("0.9"), &installer);
499 502
500 test_configurator()->SetLoopCount(1); 503 test_configurator()->SetLoopCount(1);
501 component_updater()->Start(); 504 component_updater()->Start();
502 RunThreads(); 505 RunThreads();
503 506
504 // Expect one update check and no ping. 507 // Expect one update check and no ping.
505 EXPECT_EQ(1, post_interceptor_->GetHitCount()) 508 EXPECT_EQ(1, post_interceptor_->GetHitCount())
506 << post_interceptor_->GetRequestsAsString(); 509 << post_interceptor_->GetRequestsAsString();
507 EXPECT_EQ(1, post_interceptor_->GetCount()) 510 EXPECT_EQ(1, post_interceptor_->GetCount())
508 << post_interceptor_->GetRequestsAsString(); 511 << post_interceptor_->GetRequestsAsString();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 581 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
579 "updatecheck"), test_file("updatecheck_reply_empty"))); 582 "updatecheck"), test_file("updatecheck_reply_empty")));
580 583
581 get_interceptor_->SetResponse( 584 get_interceptor_->SetResponse(
582 GURL(expected_crx_url), 585 GURL(expected_crx_url),
583 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); 586 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx"));
584 587
585 TestInstaller installer1; 588 TestInstaller installer1;
586 CrxComponent com1; 589 CrxComponent com1;
587 com1.observer = &observer1; 590 com1.observer = &observer1;
588 RegisterComponent(&com1, kTestComponent_abag, Version("2.2"), &installer1); 591 RegisterComponent(
592 &com1, kTestComponent_abag, base::Version("2.2"), &installer1);
589 TestInstaller installer2; 593 TestInstaller installer2;
590 CrxComponent com2; 594 CrxComponent com2;
591 com2.observer = &observer2; 595 com2.observer = &observer2;
592 RegisterComponent(&com2, kTestComponent_jebg, Version("0.9"), &installer2); 596 RegisterComponent(
597 &com2, kTestComponent_jebg, base::Version("0.9"), &installer2);
593 598
594 // No update normally. 599 // No update normally.
595 test_configurator()->SetLoopCount(1); 600 test_configurator()->SetLoopCount(1);
596 component_updater()->Start(); 601 component_updater()->Start();
597 RunThreads(); 602 RunThreads();
598 component_updater()->Stop(); 603 component_updater()->Stop();
599 604
600 EXPECT_EQ(1, post_interceptor_->GetHitCount()) 605 EXPECT_EQ(1, post_interceptor_->GetHitCount())
601 << post_interceptor_->GetRequestsAsString(); 606 << post_interceptor_->GetRequestsAsString();
602 EXPECT_EQ(1, post_interceptor_->GetCount()) 607 EXPECT_EQ(1, post_interceptor_->GetCount())
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 808 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
804 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 809 "updatecheck"), test_file("updatecheck_reply_1.xml")));
805 810
806 get_interceptor_->SetResponse( 811 get_interceptor_->SetResponse(
807 GURL(expected_crx_url), 812 GURL(expected_crx_url),
808 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); 813 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx"));
809 814
810 TestInstaller installer1; 815 TestInstaller installer1;
811 CrxComponent com1; 816 CrxComponent com1;
812 com1.observer = &observer1; 817 com1.observer = &observer1;
813 RegisterComponent(&com1, kTestComponent_jebg, Version("0.9"), &installer1); 818 RegisterComponent(
819 &com1, kTestComponent_jebg, base::Version("0.9"), &installer1);
814 TestInstaller installer2; 820 TestInstaller installer2;
815 CrxComponent com2; 821 CrxComponent com2;
816 com2.observer = &observer2; 822 com2.observer = &observer2;
817 RegisterComponent(&com2, kTestComponent_abag, Version("2.2"), &installer2); 823 RegisterComponent(
824 &com2, kTestComponent_abag, base::Version("2.2"), &installer2);
818 825
819 // Loop twice to issue two checks: (1) with original 0.9 version, update to 826 // Loop twice to issue two checks: (1) with original 0.9 version, update to
820 // 1.0, and do the second check (2) with the updated 1.0 version. 827 // 1.0, and do the second check (2) with the updated 1.0 version.
821 test_configurator()->SetLoopCount(2); 828 test_configurator()->SetLoopCount(2);
822 component_updater()->Start(); 829 component_updater()->Start();
823 RunThreads(); 830 RunThreads();
824 831
825 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); 832 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error());
826 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); 833 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count());
827 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); 834 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 } 884 }
878 885
879 post_interceptor_->Reset(); 886 post_interceptor_->Reset();
880 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 887 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
881 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 888 "updatecheck"), test_file("updatecheck_reply_1.xml")));
882 889
883 TestInstaller installer3; 890 TestInstaller installer3;
884 EXPECT_EQ(ComponentUpdateService::kReplaced, 891 EXPECT_EQ(ComponentUpdateService::kReplaced,
885 RegisterComponent(&com1, 892 RegisterComponent(&com1,
886 kTestComponent_jebg, 893 kTestComponent_jebg,
887 Version("2.2"), 894 base::Version("2.2"),
888 &installer3)); 895 &installer3));
889 896
890 // Loop once just to notice the check happening with the re-register version. 897 // Loop once just to notice the check happening with the re-register version.
891 test_configurator()->SetLoopCount(1); 898 test_configurator()->SetLoopCount(1);
892 component_updater()->Start(); 899 component_updater()->Start();
893 RunThreads(); 900 RunThreads();
894 901
895 // We created a new installer, so the counts go back to 0. 902 // We created a new installer, so the counts go back to 0.
896 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); 903 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error());
897 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->install_count()); 904 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->install_count());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 get_interceptor_->SetResponse( 942 get_interceptor_->SetResponse(
936 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_1.crx"), 943 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_1.crx"),
937 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1.crx")); 944 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1.crx"));
938 get_interceptor_->SetResponse( 945 get_interceptor_->SetResponse(
939 GURL("http://localhost/download/" 946 GURL("http://localhost/download/"
940 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), 947 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"),
941 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx")); 948 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"));
942 949
943 VersionedTestInstaller installer; 950 VersionedTestInstaller installer;
944 CrxComponent com; 951 CrxComponent com;
945 RegisterComponent(&com, kTestComponent_ihfo, Version("0.0"), &installer); 952 RegisterComponent(
953 &com, kTestComponent_ihfo, base::Version("0.0"), &installer);
946 954
947 test_configurator()->SetLoopCount(3); 955 test_configurator()->SetLoopCount(3);
948 component_updater()->Start(); 956 component_updater()->Start();
949 RunThreads(); 957 RunThreads();
950 958
951 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 959 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
952 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); 960 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count());
953 961
954 EXPECT_EQ(5, post_interceptor_->GetHitCount()) 962 EXPECT_EQ(5, post_interceptor_->GetHitCount())
955 << post_interceptor_->GetRequestsAsString(); 963 << post_interceptor_->GetRequestsAsString();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 get_interceptor_->SetResponse( 1014 get_interceptor_->SetResponse(
1007 GURL("http://localhost/download/" 1015 GURL("http://localhost/download/"
1008 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), 1016 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"),
1009 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx")); 1017 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"));
1010 get_interceptor_->SetResponse( 1018 get_interceptor_->SetResponse(
1011 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"), 1019 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"),
1012 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx")); 1020 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"));
1013 1021
1014 TestInstaller installer; 1022 TestInstaller installer;
1015 CrxComponent com; 1023 CrxComponent com;
1016 RegisterComponent(&com, kTestComponent_ihfo, Version("1.0"), &installer); 1024 RegisterComponent(
1025 &com, kTestComponent_ihfo, base::Version("1.0"), &installer);
1017 1026
1018 test_configurator()->SetLoopCount(2); 1027 test_configurator()->SetLoopCount(2);
1019 component_updater()->Start(); 1028 component_updater()->Start();
1020 RunThreads(); 1029 RunThreads();
1021 1030
1022 // A failed differential update does not count as a failed install. 1031 // A failed differential update does not count as a failed install.
1023 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 1032 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
1024 EXPECT_EQ(1, static_cast<TestInstaller*>(com.installer)->install_count()); 1033 EXPECT_EQ(1, static_cast<TestInstaller*>(com.installer)->install_count());
1025 1034
1026 EXPECT_EQ(3, post_interceptor_->GetHitCount()) 1035 EXPECT_EQ(3, post_interceptor_->GetHitCount())
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 1075 "updatecheck"), test_file("updatecheck_reply_1.xml")));
1067 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch("event"))); 1076 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch("event")));
1068 get_interceptor_->SetResponse( 1077 get_interceptor_->SetResponse(
1069 GURL(expected_crx_url), 1078 GURL(expected_crx_url),
1070 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); 1079 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx"));
1071 1080
1072 // Start with 0.9, and attempt update to 1.0. 1081 // Start with 0.9, and attempt update to 1.0.
1073 // Loop twice to issue two checks: (1) with original 0.9 version 1082 // Loop twice to issue two checks: (1) with original 0.9 version
1074 // and (2), which should retry with 0.9. 1083 // and (2), which should retry with 0.9.
1075 CrxComponent com; 1084 CrxComponent com;
1076 RegisterComponent(&com, kTestComponent_jebg, Version("0.9"), &installer); 1085 RegisterComponent(
1086 &com, kTestComponent_jebg, base::Version("0.9"), &installer);
1077 1087
1078 test_configurator()->SetLoopCount(2); 1088 test_configurator()->SetLoopCount(2);
1079 component_updater()->Start(); 1089 component_updater()->Start();
1080 RunThreads(); 1090 RunThreads();
1081 1091
1082 EXPECT_EQ(4, post_interceptor_->GetHitCount()) 1092 EXPECT_EQ(4, post_interceptor_->GetHitCount())
1083 << post_interceptor_->GetRequestsAsString(); 1093 << post_interceptor_->GetRequestsAsString();
1084 EXPECT_EQ(2, get_interceptor_->GetHitCount()); 1094 EXPECT_EQ(2, get_interceptor_->GetHitCount());
1085 1095
1086 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( 1096 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 get_interceptor_->SetResponse( 1164 get_interceptor_->SetResponse(
1155 GURL("http://localhost/download/" 1165 GURL("http://localhost/download/"
1156 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), 1166 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"),
1157 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx")); 1167 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx"));
1158 get_interceptor_->SetResponse( 1168 get_interceptor_->SetResponse(
1159 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"), 1169 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"),
1160 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx")); 1170 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"));
1161 1171
1162 VersionedTestInstaller installer; 1172 VersionedTestInstaller installer;
1163 CrxComponent com; 1173 CrxComponent com;
1164 RegisterComponent(&com, kTestComponent_ihfo, Version("0.0"), &installer); 1174 RegisterComponent(
1175 &com, kTestComponent_ihfo, base::Version("0.0"), &installer);
1165 1176
1166 test_configurator()->SetLoopCount(3); 1177 test_configurator()->SetLoopCount(3);
1167 component_updater()->Start(); 1178 component_updater()->Start();
1168 RunThreads(); 1179 RunThreads();
1169 component_updater()->Stop(); 1180 component_updater()->Stop();
1170 1181
1171 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 1182 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
1172 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); 1183 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count());
1173 1184
1174 EXPECT_EQ(5, post_interceptor_->GetHitCount()) 1185 EXPECT_EQ(5, post_interceptor_->GetHitCount())
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 1270
1260 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 1271 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
1261 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 1272 "updatecheck"), test_file("updatecheck_reply_1.xml")));
1262 1273
1263 TestInstaller installer; 1274 TestInstaller installer;
1264 CrxComponent com; 1275 CrxComponent com;
1265 com.observer = &observer; 1276 com.observer = &observer;
1266 EXPECT_EQ(ComponentUpdateService::kOk, 1277 EXPECT_EQ(ComponentUpdateService::kOk,
1267 RegisterComponent(&com, 1278 RegisterComponent(&com,
1268 kTestComponent_abag, 1279 kTestComponent_abag,
1269 Version("1.1"), 1280 base::Version("1.1"),
1270 &installer)); 1281 &installer));
1271 // The following two calls ensure that we don't do an update check via the 1282 // The following two calls ensure that we don't do an update check via the
1272 // timer, so the only update check should be the on-demand one. 1283 // timer, so the only update check should be the on-demand one.
1273 test_configurator()->SetInitialDelay(1000000); 1284 test_configurator()->SetInitialDelay(1000000);
1274 test_configurator()->SetRecheckTime(1000000); 1285 test_configurator()->SetRecheckTime(1000000);
1275 test_configurator()->SetLoopCount(1); 1286 test_configurator()->SetLoopCount(1);
1276 component_updater()->Start(); 1287 component_updater()->Start();
1277 1288
1278 RunThreadsUntilIdle(); 1289 RunThreadsUntilIdle();
1279 1290
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1355
1345 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 1356 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
1346 "updatecheck"), test_file("updatecheck_reply_1.xml"))); 1357 "updatecheck"), test_file("updatecheck_reply_1.xml")));
1347 1358
1348 TestInstaller installer; 1359 TestInstaller installer;
1349 CrxComponent com; 1360 CrxComponent com;
1350 com.observer = &observer; 1361 com.observer = &observer;
1351 EXPECT_EQ(ComponentUpdateService::kOk, 1362 EXPECT_EQ(ComponentUpdateService::kOk,
1352 RegisterComponent(&com, 1363 RegisterComponent(&com,
1353 kTestComponent_abag, 1364 kTestComponent_abag,
1354 Version("1.1"), 1365 base::Version("1.1"),
1355 &installer)); 1366 &installer));
1356 // The following two calls ensure that we don't do an update check via the 1367 // The following two calls ensure that we don't do an update check via the
1357 // timer, so the only update check should be the on-demand one. 1368 // timer, so the only update check should be the on-demand one.
1358 test_configurator()->SetInitialDelay(1000000); 1369 test_configurator()->SetInitialDelay(1000000);
1359 test_configurator()->SetRecheckTime(1000000); 1370 test_configurator()->SetRecheckTime(1000000);
1360 test_configurator()->SetLoopCount(1); 1371 test_configurator()->SetLoopCount(1);
1361 component_updater()->Start(); 1372 component_updater()->Start();
1362 1373
1363 RunThreadsUntilIdle(); 1374 RunThreadsUntilIdle();
1364 1375
(...skipping 14 matching lines...) Expand all
1379 EXPECT_EQ(1, post_interceptor_->GetHitCount()); 1390 EXPECT_EQ(1, post_interceptor_->GetHitCount());
1380 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 1391 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
1381 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); 1392 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count());
1382 1393
1383 component_updater()->Stop(); 1394 component_updater()->Stop();
1384 } 1395 }
1385 1396
1386 1397
1387 } // namespace component_updater 1398 } // namespace component_updater
1388 1399
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698