OLD | NEW |
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 Loading... |
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 base::Version& version, | 212 const 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 Loading... |
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 base::Version("1.1"), | 291 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 Loading... |
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( | 429 RegisterComponent(&com1, kTestComponent_jebg, Version("0.9"), &installer1); |
430 &com1, kTestComponent_jebg, base::Version("0.9"), &installer1); | |
431 TestInstaller installer2; | 430 TestInstaller installer2; |
432 CrxComponent com2; | 431 CrxComponent com2; |
433 com2.observer = &observer2; | 432 com2.observer = &observer2; |
434 RegisterComponent( | 433 RegisterComponent(&com2, kTestComponent_abag, Version("2.2"), &installer2); |
435 &com2, kTestComponent_abag, base::Version("2.2"), &installer2); | |
436 | 434 |
437 test_configurator()->SetLoopCount(2); | 435 test_configurator()->SetLoopCount(2); |
438 component_updater()->Start(); | 436 component_updater()->Start(); |
439 RunThreads(); | 437 RunThreads(); |
440 | 438 |
441 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); | 439 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); |
442 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); | 440 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); |
443 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); | 441 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); |
444 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count()); | 442 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->install_count()); |
445 | 443 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { | 488 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { |
491 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 489 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
492 "updatecheck"), test_file("updatecheck_reply_2.xml"))); | 490 "updatecheck"), test_file("updatecheck_reply_2.xml"))); |
493 | 491 |
494 get_interceptor_->SetResponse( | 492 get_interceptor_->SetResponse( |
495 GURL(expected_crx_url), | 493 GURL(expected_crx_url), |
496 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); | 494 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); |
497 | 495 |
498 TestInstaller installer; | 496 TestInstaller installer; |
499 CrxComponent com; | 497 CrxComponent com; |
500 RegisterComponent( | 498 RegisterComponent(&com, kTestComponent_jebg, Version("0.9"), &installer); |
501 &com, kTestComponent_jebg, base::Version("0.9"), &installer); | |
502 | 499 |
503 test_configurator()->SetLoopCount(1); | 500 test_configurator()->SetLoopCount(1); |
504 component_updater()->Start(); | 501 component_updater()->Start(); |
505 RunThreads(); | 502 RunThreads(); |
506 | 503 |
507 // Expect one update check and no ping. | 504 // Expect one update check and no ping. |
508 EXPECT_EQ(1, post_interceptor_->GetHitCount()) | 505 EXPECT_EQ(1, post_interceptor_->GetHitCount()) |
509 << post_interceptor_->GetRequestsAsString(); | 506 << post_interceptor_->GetRequestsAsString(); |
510 EXPECT_EQ(1, post_interceptor_->GetCount()) | 507 EXPECT_EQ(1, post_interceptor_->GetCount()) |
511 << post_interceptor_->GetRequestsAsString(); | 508 << post_interceptor_->GetRequestsAsString(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 578 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
582 "updatecheck"), test_file("updatecheck_reply_empty"))); | 579 "updatecheck"), test_file("updatecheck_reply_empty"))); |
583 | 580 |
584 get_interceptor_->SetResponse( | 581 get_interceptor_->SetResponse( |
585 GURL(expected_crx_url), | 582 GURL(expected_crx_url), |
586 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); | 583 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); |
587 | 584 |
588 TestInstaller installer1; | 585 TestInstaller installer1; |
589 CrxComponent com1; | 586 CrxComponent com1; |
590 com1.observer = &observer1; | 587 com1.observer = &observer1; |
591 RegisterComponent( | 588 RegisterComponent(&com1, kTestComponent_abag, Version("2.2"), &installer1); |
592 &com1, kTestComponent_abag, base::Version("2.2"), &installer1); | |
593 TestInstaller installer2; | 589 TestInstaller installer2; |
594 CrxComponent com2; | 590 CrxComponent com2; |
595 com2.observer = &observer2; | 591 com2.observer = &observer2; |
596 RegisterComponent( | 592 RegisterComponent(&com2, kTestComponent_jebg, Version("0.9"), &installer2); |
597 &com2, kTestComponent_jebg, base::Version("0.9"), &installer2); | |
598 | 593 |
599 // No update normally. | 594 // No update normally. |
600 test_configurator()->SetLoopCount(1); | 595 test_configurator()->SetLoopCount(1); |
601 component_updater()->Start(); | 596 component_updater()->Start(); |
602 RunThreads(); | 597 RunThreads(); |
603 component_updater()->Stop(); | 598 component_updater()->Stop(); |
604 | 599 |
605 EXPECT_EQ(1, post_interceptor_->GetHitCount()) | 600 EXPECT_EQ(1, post_interceptor_->GetHitCount()) |
606 << post_interceptor_->GetRequestsAsString(); | 601 << post_interceptor_->GetRequestsAsString(); |
607 EXPECT_EQ(1, post_interceptor_->GetCount()) | 602 EXPECT_EQ(1, post_interceptor_->GetCount()) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 803 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
809 "updatecheck"), test_file("updatecheck_reply_1.xml"))); | 804 "updatecheck"), test_file("updatecheck_reply_1.xml"))); |
810 | 805 |
811 get_interceptor_->SetResponse( | 806 get_interceptor_->SetResponse( |
812 GURL(expected_crx_url), | 807 GURL(expected_crx_url), |
813 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); | 808 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); |
814 | 809 |
815 TestInstaller installer1; | 810 TestInstaller installer1; |
816 CrxComponent com1; | 811 CrxComponent com1; |
817 com1.observer = &observer1; | 812 com1.observer = &observer1; |
818 RegisterComponent( | 813 RegisterComponent(&com1, kTestComponent_jebg, Version("0.9"), &installer1); |
819 &com1, kTestComponent_jebg, base::Version("0.9"), &installer1); | |
820 TestInstaller installer2; | 814 TestInstaller installer2; |
821 CrxComponent com2; | 815 CrxComponent com2; |
822 com2.observer = &observer2; | 816 com2.observer = &observer2; |
823 RegisterComponent( | 817 RegisterComponent(&com2, kTestComponent_abag, Version("2.2"), &installer2); |
824 &com2, kTestComponent_abag, base::Version("2.2"), &installer2); | |
825 | 818 |
826 // Loop twice to issue two checks: (1) with original 0.9 version, update to | 819 // Loop twice to issue two checks: (1) with original 0.9 version, update to |
827 // 1.0, and do the second check (2) with the updated 1.0 version. | 820 // 1.0, and do the second check (2) with the updated 1.0 version. |
828 test_configurator()->SetLoopCount(2); | 821 test_configurator()->SetLoopCount(2); |
829 component_updater()->Start(); | 822 component_updater()->Start(); |
830 RunThreads(); | 823 RunThreads(); |
831 | 824 |
832 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); | 825 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); |
833 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); | 826 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); |
834 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); | 827 EXPECT_EQ(0, static_cast<TestInstaller*>(com2.installer)->error()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 } | 877 } |
885 | 878 |
886 post_interceptor_->Reset(); | 879 post_interceptor_->Reset(); |
887 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 880 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
888 "updatecheck"), test_file("updatecheck_reply_1.xml"))); | 881 "updatecheck"), test_file("updatecheck_reply_1.xml"))); |
889 | 882 |
890 TestInstaller installer3; | 883 TestInstaller installer3; |
891 EXPECT_EQ(ComponentUpdateService::kReplaced, | 884 EXPECT_EQ(ComponentUpdateService::kReplaced, |
892 RegisterComponent(&com1, | 885 RegisterComponent(&com1, |
893 kTestComponent_jebg, | 886 kTestComponent_jebg, |
894 base::Version("2.2"), | 887 Version("2.2"), |
895 &installer3)); | 888 &installer3)); |
896 | 889 |
897 // Loop once just to notice the check happening with the re-register version. | 890 // Loop once just to notice the check happening with the re-register version. |
898 test_configurator()->SetLoopCount(1); | 891 test_configurator()->SetLoopCount(1); |
899 component_updater()->Start(); | 892 component_updater()->Start(); |
900 RunThreads(); | 893 RunThreads(); |
901 | 894 |
902 // We created a new installer, so the counts go back to 0. | 895 // We created a new installer, so the counts go back to 0. |
903 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); | 896 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); |
904 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->install_count()); | 897 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->install_count()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 get_interceptor_->SetResponse( | 935 get_interceptor_->SetResponse( |
943 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_1.crx"), | 936 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_1.crx"), |
944 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1.crx")); | 937 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1.crx")); |
945 get_interceptor_->SetResponse( | 938 get_interceptor_->SetResponse( |
946 GURL("http://localhost/download/" | 939 GURL("http://localhost/download/" |
947 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), | 940 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), |
948 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx")); | 941 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx")); |
949 | 942 |
950 VersionedTestInstaller installer; | 943 VersionedTestInstaller installer; |
951 CrxComponent com; | 944 CrxComponent com; |
952 RegisterComponent( | 945 RegisterComponent(&com, kTestComponent_ihfo, Version("0.0"), &installer); |
953 &com, kTestComponent_ihfo, base::Version("0.0"), &installer); | |
954 | 946 |
955 test_configurator()->SetLoopCount(3); | 947 test_configurator()->SetLoopCount(3); |
956 component_updater()->Start(); | 948 component_updater()->Start(); |
957 RunThreads(); | 949 RunThreads(); |
958 | 950 |
959 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 951 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
960 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); | 952 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); |
961 | 953 |
962 EXPECT_EQ(5, post_interceptor_->GetHitCount()) | 954 EXPECT_EQ(5, post_interceptor_->GetHitCount()) |
963 << post_interceptor_->GetRequestsAsString(); | 955 << post_interceptor_->GetRequestsAsString(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 get_interceptor_->SetResponse( | 1006 get_interceptor_->SetResponse( |
1015 GURL("http://localhost/download/" | 1007 GURL("http://localhost/download/" |
1016 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), | 1008 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), |
1017 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx")); | 1009 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx")); |
1018 get_interceptor_->SetResponse( | 1010 get_interceptor_->SetResponse( |
1019 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"), | 1011 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"), |
1020 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx")); | 1012 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx")); |
1021 | 1013 |
1022 TestInstaller installer; | 1014 TestInstaller installer; |
1023 CrxComponent com; | 1015 CrxComponent com; |
1024 RegisterComponent( | 1016 RegisterComponent(&com, kTestComponent_ihfo, Version("1.0"), &installer); |
1025 &com, kTestComponent_ihfo, base::Version("1.0"), &installer); | |
1026 | 1017 |
1027 test_configurator()->SetLoopCount(2); | 1018 test_configurator()->SetLoopCount(2); |
1028 component_updater()->Start(); | 1019 component_updater()->Start(); |
1029 RunThreads(); | 1020 RunThreads(); |
1030 | 1021 |
1031 // A failed differential update does not count as a failed install. | 1022 // A failed differential update does not count as a failed install. |
1032 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 1023 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
1033 EXPECT_EQ(1, static_cast<TestInstaller*>(com.installer)->install_count()); | 1024 EXPECT_EQ(1, static_cast<TestInstaller*>(com.installer)->install_count()); |
1034 | 1025 |
1035 EXPECT_EQ(3, post_interceptor_->GetHitCount()) | 1026 EXPECT_EQ(3, post_interceptor_->GetHitCount()) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 "updatecheck"), test_file("updatecheck_reply_1.xml"))); | 1072 "updatecheck"), test_file("updatecheck_reply_1.xml"))); |
1082 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch("event"))); | 1073 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch("event"))); |
1083 get_interceptor_->SetResponse( | 1074 get_interceptor_->SetResponse( |
1084 GURL(expected_crx_url), | 1075 GURL(expected_crx_url), |
1085 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); | 1076 test_file("jebgalgnebhfojomionfpkfelancnnkf.crx")); |
1086 | 1077 |
1087 // Start with 0.9, and attempt update to 1.0. | 1078 // Start with 0.9, and attempt update to 1.0. |
1088 // Loop twice to issue two checks: (1) with original 0.9 version | 1079 // Loop twice to issue two checks: (1) with original 0.9 version |
1089 // and (2), which should retry with 0.9. | 1080 // and (2), which should retry with 0.9. |
1090 CrxComponent com; | 1081 CrxComponent com; |
1091 RegisterComponent( | 1082 RegisterComponent(&com, kTestComponent_jebg, Version("0.9"), &installer); |
1092 &com, kTestComponent_jebg, base::Version("0.9"), &installer); | |
1093 | 1083 |
1094 test_configurator()->SetLoopCount(2); | 1084 test_configurator()->SetLoopCount(2); |
1095 component_updater()->Start(); | 1085 component_updater()->Start(); |
1096 RunThreads(); | 1086 RunThreads(); |
1097 | 1087 |
1098 EXPECT_EQ(4, post_interceptor_->GetHitCount()) | 1088 EXPECT_EQ(4, post_interceptor_->GetHitCount()) |
1099 << post_interceptor_->GetRequestsAsString(); | 1089 << post_interceptor_->GetRequestsAsString(); |
1100 EXPECT_EQ(2, get_interceptor_->GetHitCount()); | 1090 EXPECT_EQ(2, get_interceptor_->GetHitCount()); |
1101 | 1091 |
1102 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( | 1092 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 get_interceptor_->SetResponse( | 1160 get_interceptor_->SetResponse( |
1171 GURL("http://localhost/download/" | 1161 GURL("http://localhost/download/" |
1172 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), | 1162 "ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx"), |
1173 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx")); | 1163 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx")); |
1174 get_interceptor_->SetResponse( | 1164 get_interceptor_->SetResponse( |
1175 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"), | 1165 GURL("http://localhost/download/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx"), |
1176 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx")); | 1166 test_file("ihfokbkgjpifnbbojhneepfflplebdkc_2.crx")); |
1177 | 1167 |
1178 VersionedTestInstaller installer; | 1168 VersionedTestInstaller installer; |
1179 CrxComponent com; | 1169 CrxComponent com; |
1180 RegisterComponent( | 1170 RegisterComponent(&com, kTestComponent_ihfo, Version("0.0"), &installer); |
1181 &com, kTestComponent_ihfo, base::Version("0.0"), &installer); | |
1182 | 1171 |
1183 test_configurator()->SetLoopCount(3); | 1172 test_configurator()->SetLoopCount(3); |
1184 component_updater()->Start(); | 1173 component_updater()->Start(); |
1185 RunThreads(); | 1174 RunThreads(); |
1186 component_updater()->Stop(); | 1175 component_updater()->Stop(); |
1187 | 1176 |
1188 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 1177 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
1189 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); | 1178 EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count()); |
1190 | 1179 |
1191 EXPECT_EQ(5, post_interceptor_->GetHitCount()) | 1180 EXPECT_EQ(5, post_interceptor_->GetHitCount()) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 | 1265 |
1277 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 1266 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
1278 "updatecheck"), test_file("updatecheck_reply_1.xml"))); | 1267 "updatecheck"), test_file("updatecheck_reply_1.xml"))); |
1279 | 1268 |
1280 TestInstaller installer; | 1269 TestInstaller installer; |
1281 CrxComponent com; | 1270 CrxComponent com; |
1282 com.observer = &observer; | 1271 com.observer = &observer; |
1283 EXPECT_EQ(ComponentUpdateService::kOk, | 1272 EXPECT_EQ(ComponentUpdateService::kOk, |
1284 RegisterComponent(&com, | 1273 RegisterComponent(&com, |
1285 kTestComponent_abag, | 1274 kTestComponent_abag, |
1286 base::Version("1.1"), | 1275 Version("1.1"), |
1287 &installer)); | 1276 &installer)); |
1288 // The following two calls ensure that we don't do an update check via the | 1277 // The following two calls ensure that we don't do an update check via the |
1289 // timer, so the only update check should be the on-demand one. | 1278 // timer, so the only update check should be the on-demand one. |
1290 test_configurator()->SetInitialDelay(1000000); | 1279 test_configurator()->SetInitialDelay(1000000); |
1291 test_configurator()->SetRecheckTime(1000000); | 1280 test_configurator()->SetRecheckTime(1000000); |
1292 test_configurator()->SetLoopCount(1); | 1281 test_configurator()->SetLoopCount(1); |
1293 component_updater()->Start(); | 1282 component_updater()->Start(); |
1294 | 1283 |
1295 RunThreadsUntilIdle(); | 1284 RunThreadsUntilIdle(); |
1296 | 1285 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 | 1350 |
1362 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 1351 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
1363 "updatecheck"), test_file("updatecheck_reply_1.xml"))); | 1352 "updatecheck"), test_file("updatecheck_reply_1.xml"))); |
1364 | 1353 |
1365 TestInstaller installer; | 1354 TestInstaller installer; |
1366 CrxComponent com; | 1355 CrxComponent com; |
1367 com.observer = &observer; | 1356 com.observer = &observer; |
1368 EXPECT_EQ(ComponentUpdateService::kOk, | 1357 EXPECT_EQ(ComponentUpdateService::kOk, |
1369 RegisterComponent(&com, | 1358 RegisterComponent(&com, |
1370 kTestComponent_abag, | 1359 kTestComponent_abag, |
1371 base::Version("1.1"), | 1360 Version("1.1"), |
1372 &installer)); | 1361 &installer)); |
1373 // The following two calls ensure that we don't do an update check via the | 1362 // The following two calls ensure that we don't do an update check via the |
1374 // timer, so the only update check should be the on-demand one. | 1363 // timer, so the only update check should be the on-demand one. |
1375 test_configurator()->SetInitialDelay(1000000); | 1364 test_configurator()->SetInitialDelay(1000000); |
1376 test_configurator()->SetRecheckTime(1000000); | 1365 test_configurator()->SetRecheckTime(1000000); |
1377 test_configurator()->SetLoopCount(1); | 1366 test_configurator()->SetLoopCount(1); |
1378 component_updater()->Start(); | 1367 component_updater()->Start(); |
1379 | 1368 |
1380 RunThreadsUntilIdle(); | 1369 RunThreadsUntilIdle(); |
1381 | 1370 |
(...skipping 14 matching lines...) Expand all Loading... |
1396 EXPECT_EQ(1, post_interceptor_->GetHitCount()); | 1385 EXPECT_EQ(1, post_interceptor_->GetHitCount()); |
1397 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 1386 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
1398 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); | 1387 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); |
1399 | 1388 |
1400 component_updater()->Stop(); | 1389 component_updater()->Stop(); |
1401 } | 1390 } |
1402 | 1391 |
1403 | 1392 |
1404 } // namespace component_updater | 1393 } // namespace component_updater |
1405 | 1394 |
OLD | NEW |