| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 EXPECT_EQ("/bar", url.path()); | 361 EXPECT_EQ("/bar", url.path()); |
| 362 | 362 |
| 363 // Validate the extension request parameters in the query. It should | 363 // Validate the extension request parameters in the query. It should |
| 364 // look something like "?x=id%3D<id>%26v%3D<version>%26uc". | 364 // look something like "?x=id%3D<id>%26v%3D<version>%26uc". |
| 365 EXPECT_TRUE(url.has_query()); | 365 EXPECT_TRUE(url.has_query()); |
| 366 std::vector<std::string> parts; | 366 std::vector<std::string> parts; |
| 367 base::SplitString(url.query(), '=', &parts); | 367 base::SplitString(url.query(), '=', &parts); |
| 368 EXPECT_EQ(2u, parts.size()); | 368 EXPECT_EQ(2u, parts.size()); |
| 369 EXPECT_EQ("x", parts[0]); | 369 EXPECT_EQ("x", parts[0]); |
| 370 std::string decoded = net::UnescapeURLComponent( | 370 std::string decoded = net::UnescapeURLComponent( |
| 371 parts[1], UnescapeRule::URL_SPECIAL_CHARS); | 371 parts[1], net::UnescapeRule::URL_SPECIAL_CHARS); |
| 372 std::map<std::string, std::string> params; | 372 std::map<std::string, std::string> params; |
| 373 ExtractParameters(decoded, ¶ms); | 373 ExtractParameters(decoded, ¶ms); |
| 374 if (pending) { | 374 if (pending) { |
| 375 EXPECT_EQ(pending_extension_manager->begin()->first, params["id"]); | 375 EXPECT_EQ(pending_extension_manager->begin()->first, params["id"]); |
| 376 EXPECT_EQ("0.0.0.0", params["v"]); | 376 EXPECT_EQ("0.0.0.0", params["v"]); |
| 377 } else { | 377 } else { |
| 378 EXPECT_EQ(extensions[0]->id(), params["id"]); | 378 EXPECT_EQ(extensions[0]->id(), params["id"]); |
| 379 EXPECT_EQ(extensions[0]->VersionString(), params["v"]); | 379 EXPECT_EQ(extensions[0]->VersionString(), params["v"]); |
| 380 } | 380 } |
| 381 EXPECT_EQ("", params["uc"]); | 381 EXPECT_EQ("", params["uc"]); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 412 EXPECT_EQ("/service/update2/crx", url.path()); | 412 EXPECT_EQ("/service/update2/crx", url.path()); |
| 413 | 413 |
| 414 // Validate the extension request parameters in the query. It should | 414 // Validate the extension request parameters in the query. It should |
| 415 // look something like "?x=id%3D<id>%26v%3D<version>%26uc". | 415 // look something like "?x=id%3D<id>%26v%3D<version>%26uc". |
| 416 EXPECT_TRUE(url.has_query()); | 416 EXPECT_TRUE(url.has_query()); |
| 417 std::vector<std::string> parts; | 417 std::vector<std::string> parts; |
| 418 base::SplitString(url.query(), '=', &parts); | 418 base::SplitString(url.query(), '=', &parts); |
| 419 EXPECT_EQ(2u, parts.size()); | 419 EXPECT_EQ(2u, parts.size()); |
| 420 EXPECT_EQ("x", parts[0]); | 420 EXPECT_EQ("x", parts[0]); |
| 421 std::string decoded = net::UnescapeURLComponent( | 421 std::string decoded = net::UnescapeURLComponent( |
| 422 parts[1], UnescapeRule::URL_SPECIAL_CHARS); | 422 parts[1], net::UnescapeRule::URL_SPECIAL_CHARS); |
| 423 std::map<std::string, std::string> params; | 423 std::map<std::string, std::string> params; |
| 424 ExtractParameters(decoded, ¶ms); | 424 ExtractParameters(decoded, ¶ms); |
| 425 EXPECT_EQ("com.google.crx.blacklist", params["id"]); | 425 EXPECT_EQ("com.google.crx.blacklist", params["id"]); |
| 426 EXPECT_EQ("0", params["v"]); | 426 EXPECT_EQ("0", params["v"]); |
| 427 EXPECT_EQ("", params["uc"]); | 427 EXPECT_EQ("", params["uc"]); |
| 428 EXPECT_TRUE(ContainsKey(params, "ping")); | 428 EXPECT_TRUE(ContainsKey(params, "ping")); |
| 429 } | 429 } |
| 430 | 430 |
| 431 static void TestUpdateUrlDataEmpty() { | 431 static void TestUpdateUrlDataEmpty() { |
| 432 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 432 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 | 1260 |
| 1261 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 1261 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
| 1262 // -prodversionmin (shouldn't update if browser version too old) | 1262 // -prodversionmin (shouldn't update if browser version too old) |
| 1263 // -manifests & updates arriving out of order / interleaved | 1263 // -manifests & updates arriving out of order / interleaved |
| 1264 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1264 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
| 1265 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1265 // -An extension gets uninstalled while updates are in progress (so it doesn't |
| 1266 // "come back from the dead") | 1266 // "come back from the dead") |
| 1267 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1267 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
| 1268 // you don't get downgraded accidentally) | 1268 // you don't get downgraded accidentally) |
| 1269 // -An update manifest mentions multiple updates | 1269 // -An update manifest mentions multiple updates |
| OLD | NEW |