| Index: chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| index 33ae029f269379838d8a8a9708bbc08aa92ef1f5..5137a45cbffde7e80e8eac895ba7b4ed92a77ac0 100644
|
| --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| @@ -127,8 +127,6 @@ const net::BackoffEntry::Policy kNoBackoffPolicy = {
|
| false,
|
| };
|
|
|
| -const char kEmptyUpdateUrlData[] = "";
|
| -
|
| const char kAuthUserQueryKey[] = "authuser";
|
|
|
| int kExpectedLoadFlags =
|
| @@ -763,7 +761,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| fetch_data->AddExtension(id, version, &kNeverPingedData, std::string(),
|
| - std::string());
|
| + nullptr);
|
|
|
| std::map<std::string, std::string> params;
|
| VerifyQueryAndExtractParameters(fetch_data->full_url().query(), ¶ms);
|
| @@ -780,8 +778,10 @@ class ExtensionUpdaterTest : public testing::Test {
|
| // option to appear in the x= parameter.
|
| std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| - fetch_data->AddExtension(id, version, &kNeverPingedData, "bar",
|
| - std::string());
|
| + ManifestFetchData::ExtraParams extra;
|
| + extra.update_url_data = std::string("bar");
|
| + fetch_data->AddExtension(id, version, &kNeverPingedData, std::string(),
|
| + &extra);
|
| std::map<std::string, std::string> params;
|
| VerifyQueryAndExtractParameters(fetch_data->full_url().query(), ¶ms);
|
| EXPECT_EQ(id, params["id"]);
|
| @@ -797,8 +797,10 @@ class ExtensionUpdaterTest : public testing::Test {
|
| // option to appear in the x= parameter.
|
| std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| - fetch_data->AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c",
|
| - std::string());
|
| + ManifestFetchData::ExtraParams extra;
|
| + extra.update_url_data = std::string("a=1&b=2&c");
|
| + fetch_data->AddExtension(id, version, &kNeverPingedData, std::string(),
|
| + &extra);
|
| std::map<std::string, std::string> params;
|
| VerifyQueryAndExtractParameters(fetch_data->full_url().query(), ¶ms);
|
| EXPECT_EQ(id, params["id"]);
|
| @@ -842,8 +844,8 @@ class ExtensionUpdaterTest : public testing::Test {
|
| // Make sure that an installsource= appears in the x= parameter.
|
| std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| - fetch_data->AddExtension(id, version, &kNeverPingedData,
|
| - kEmptyUpdateUrlData, install_source);
|
| + fetch_data->AddExtension(id, version, &kNeverPingedData, install_source,
|
| + nullptr);
|
| std::map<std::string, std::string> params;
|
| VerifyQueryAndExtractParameters(fetch_data->full_url().query(), ¶ms);
|
| EXPECT_EQ(id, params["id"]);
|
| @@ -869,11 +871,11 @@ class ExtensionUpdaterTest : public testing::Test {
|
| // installed and available at v2.0).
|
| const std::string id1 = crx_file::id_util::GenerateId("1");
|
| const std::string id2 = crx_file::id_util::GenerateId("2");
|
| - fetch_data->AddExtension(id1, "1.0.0.0", &kNeverPingedData,
|
| - kEmptyUpdateUrlData, std::string());
|
| + fetch_data->AddExtension(id1, "1.0.0.0", &kNeverPingedData, std::string(),
|
| + nullptr);
|
| AddParseResult(id1, "1.1", "http://localhost/e1_1.1.crx", &updates);
|
| - fetch_data->AddExtension(id2, "2.0.0.0", &kNeverPingedData,
|
| - kEmptyUpdateUrlData, std::string());
|
| + fetch_data->AddExtension(id2, "2.0.0.0", &kNeverPingedData, std::string(),
|
| + nullptr);
|
| AddParseResult(id2, "2.0.0.0", "http://localhost/e2_2.0.crx", &updates);
|
|
|
| EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(false));
|
| @@ -911,8 +913,8 @@ class ExtensionUpdaterTest : public testing::Test {
|
| std::list<std::string>::const_iterator it;
|
| for (it = ids_for_update_check.begin();
|
| it != ids_for_update_check.end(); ++it) {
|
| - fetch_data->AddExtension(*it, "1.0.0.0", &kNeverPingedData,
|
| - kEmptyUpdateUrlData, std::string());
|
| + fetch_data->AddExtension(*it, "1.0.0.0", &kNeverPingedData, std::string(),
|
| + nullptr);
|
| AddParseResult(*it, "1.1", "http://localhost/e1_1.1.crx", &updates);
|
| }
|
|
|
| @@ -949,14 +951,10 @@ class ExtensionUpdaterTest : public testing::Test {
|
| std::unique_ptr<ManifestFetchData> fetch4(
|
| CreateManifestFetchData(kUpdateUrl));
|
| ManifestFetchData::PingData zeroDays(0, 0, true, 0);
|
| - fetch1->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
|
| - std::string());
|
| - fetch2->AddExtension("2222", "2.0", &zeroDays, kEmptyUpdateUrlData,
|
| - std::string());
|
| - fetch3->AddExtension("3333", "3.0", &zeroDays, kEmptyUpdateUrlData,
|
| - std::string());
|
| - fetch4->AddExtension("4444", "4.0", &zeroDays, kEmptyUpdateUrlData,
|
| - std::string());
|
| + fetch1->AddExtension("1111", "1.0", &zeroDays, std::string(), nullptr);
|
| + fetch2->AddExtension("2222", "2.0", &zeroDays, std::string(), nullptr);
|
| + fetch3->AddExtension("3333", "3.0", &zeroDays, std::string(), nullptr);
|
| + fetch4->AddExtension("4444", "4.0", &zeroDays, std::string(), nullptr);
|
|
|
| // This will start the first fetcher and queue the others. The next in queue
|
| // is started as each fetcher receives its response. Note that the fetchers
|
| @@ -1087,8 +1085,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| std::unique_ptr<ManifestFetchData> fetch(
|
| CreateManifestFetchData(kUpdateUrl));
|
| ManifestFetchData::PingData zeroDays(0, 0, true, 0);
|
| - fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
|
| - std::string());
|
| + fetch->AddExtension("1111", "1.0", &zeroDays, std::string(), nullptr);
|
|
|
| // This will start the first fetcher.
|
| downloader.StartUpdateCheck(std::move(fetch));
|
| @@ -1115,8 +1112,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| // For response codes that are not in the 5xx range ExtensionDownloader
|
| // should not retry.
|
| fetch.reset(CreateManifestFetchData(kUpdateUrl));
|
| - fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
|
| - std::string());
|
| + fetch->AddExtension("1111", "1.0", &zeroDays, std::string(), nullptr);
|
|
|
| // This will start the first fetcher.
|
| downloader.StartUpdateCheck(std::move(fetch));
|
| @@ -1778,8 +1774,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| CreateManifestFetchData(update_url));
|
| const Extension* extension = tmp[0].get();
|
| fetch_data->AddExtension(extension->id(), extension->VersionString(),
|
| - &kNeverPingedData, kEmptyUpdateUrlData,
|
| - std::string());
|
| + &kNeverPingedData, std::string(), nullptr);
|
| UpdateManifest::Results results;
|
| results.daystart_elapsed_seconds = 750;
|
|
|
| @@ -2131,22 +2126,22 @@ TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) {
|
| // the delegate.
|
| std::string id = crx_file::id_util::GenerateId("foo");
|
| EXPECT_CALL(delegate, GetPingDataForExtension(id, _)).WillOnce(Return(false));
|
| - EXPECT_TRUE(
|
| - downloader->AddPendingExtension(id, GURL("http://example.com/update"),
|
| - 0));
|
| + EXPECT_TRUE(downloader->AddPendingExtension(
|
| + id, GURL("http://example.com/update"), false, 0));
|
| downloader->StartAllPending(NULL);
|
| Mock::VerifyAndClearExpectations(&delegate);
|
| EXPECT_EQ(1u, ManifestFetchersCount(downloader.get()));
|
|
|
| // Extensions with invalid update URLs should be rejected.
|
| id = crx_file::id_util::GenerateId("foo2");
|
| - EXPECT_FALSE(
|
| - downloader->AddPendingExtension(id, GURL("http:google.com:foo"), 0));
|
| + EXPECT_FALSE(downloader->AddPendingExtension(id, GURL("http:google.com:foo"),
|
| + false, 0));
|
| downloader->StartAllPending(NULL);
|
| EXPECT_EQ(1u, ManifestFetchersCount(downloader.get()));
|
|
|
| // Extensions with empty IDs should be rejected.
|
| - EXPECT_FALSE(downloader->AddPendingExtension(std::string(), GURL(), 0));
|
| + EXPECT_FALSE(
|
| + downloader->AddPendingExtension(std::string(), GURL(), false, 0));
|
| downloader->StartAllPending(NULL);
|
| EXPECT_EQ(1u, ManifestFetchersCount(downloader.get()));
|
|
|
| @@ -2162,7 +2157,7 @@ TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) {
|
| // filled in.
|
| id = crx_file::id_util::GenerateId("foo3");
|
| EXPECT_CALL(delegate, GetPingDataForExtension(id, _)).WillOnce(Return(false));
|
| - EXPECT_TRUE(downloader->AddPendingExtension(id, GURL(), 0));
|
| + EXPECT_TRUE(downloader->AddPendingExtension(id, GURL(), false, 0));
|
| downloader->StartAllPending(NULL);
|
| EXPECT_EQ(1u, ManifestFetchersCount(downloader.get()));
|
|
|
|
|