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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // puts the key/value pairs into |result|. For keys with no value, the empty | 272 // puts the key/value pairs into |result|. For keys with no value, the empty |
273 // string is used. So for "a=1&b=foo&c", result would map "a" to "1", "b" to | 273 // string is used. So for "a=1&b=foo&c", result would map "a" to "1", "b" to |
274 // "foo", and "c" to "". | 274 // "foo", and "c" to "". |
275 static void ExtractParameters(const std::string& params, | 275 static void ExtractParameters(const std::string& params, |
276 std::map<std::string, std::string>* result) { | 276 std::map<std::string, std::string>* result) { |
277 std::vector<std::string> pairs; | 277 std::vector<std::string> pairs; |
278 base::SplitString(params, '&', &pairs); | 278 base::SplitString(params, '&', &pairs); |
279 for (size_t i = 0; i < pairs.size(); i++) { | 279 for (size_t i = 0; i < pairs.size(); i++) { |
280 std::vector<std::string> key_val; | 280 std::vector<std::string> key_val; |
281 base::SplitString(pairs[i], '=', &key_val); | 281 base::SplitString(pairs[i], '=', &key_val); |
282 if (key_val.size() > 0) { | 282 if (!key_val.empty()) { |
283 std::string key = key_val[0]; | 283 std::string key = key_val[0]; |
284 EXPECT_TRUE(result->find(key) == result->end()); | 284 EXPECT_TRUE(result->find(key) == result->end()); |
285 (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; | 285 (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; |
286 } else { | 286 } else { |
287 NOTREACHED(); | 287 NOTREACHED(); |
288 } | 288 } |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 // All of our tests that need to use private APIs of ExtensionUpdater live | 292 // All of our tests that need to use private APIs of ExtensionUpdater live |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 | 1069 |
1070 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 1070 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
1071 // -prodversionmin (shouldn't update if browser version too old) | 1071 // -prodversionmin (shouldn't update if browser version too old) |
1072 // -manifests & updates arriving out of order / interleaved | 1072 // -manifests & updates arriving out of order / interleaved |
1073 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1073 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
1074 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1074 // -An extension gets uninstalled while updates are in progress (so it doesn't |
1075 // "come back from the dead") | 1075 // "come back from the dead") |
1076 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1076 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
1077 // you don't get downgraded accidentally) | 1077 // you don't get downgraded accidentally) |
1078 // -An update manifest mentions multiple updates | 1078 // -An update manifest mentions multiple updates |
OLD | NEW |