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

Side by Side Diff: chrome/browser/extensions/updater/extension_updater_unittest.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « chrome/browser/extensions/install_signer.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <list> 5 #include <list>
6 #include <map> 6 #include <map>
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 }; 550 };
551 551
552 static const int kUpdateFrequencySecs = 15; 552 static const int kUpdateFrequencySecs = 15;
553 553
554 // Takes a string with KEY=VALUE parameters separated by '&' in |params| and 554 // Takes a string with KEY=VALUE parameters separated by '&' in |params| and
555 // puts the key/value pairs into |result|. For keys with no value, the empty 555 // puts the key/value pairs into |result|. For keys with no value, the empty
556 // string is used. So for "a=1&b=foo&c", result would map "a" to "1", "b" to 556 // string is used. So for "a=1&b=foo&c", result would map "a" to "1", "b" to
557 // "foo", and "c" to "". 557 // "foo", and "c" to "".
558 static void ExtractParameters(const std::string& params, 558 static void ExtractParameters(const std::string& params,
559 std::map<std::string, std::string>* result) { 559 std::map<std::string, std::string>* result) {
560 std::vector<std::string> pairs; 560 for (const std::string& pair : base::SplitString(
561 base::SplitString(params, '&', &pairs); 561 params, "&", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
562 for (size_t i = 0; i < pairs.size(); i++) { 562 std::vector<std::string> key_val = base::SplitString(
563 std::vector<std::string> key_val; 563 pair, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
564 base::SplitString(pairs[i], '=', &key_val);
565 if (!key_val.empty()) { 564 if (!key_val.empty()) {
566 std::string key = key_val[0]; 565 std::string key = key_val[0];
567 EXPECT_TRUE(result->find(key) == result->end()); 566 EXPECT_TRUE(result->find(key) == result->end());
568 (*result)[key] = (key_val.size() == 2) ? key_val[1] : std::string(); 567 (*result)[key] = (key_val.size() == 2) ? key_val[1] : std::string();
569 } else { 568 } else {
570 NOTREACHED(); 569 NOTREACHED();
571 } 570 }
572 } 571 }
573 } 572 }
574 573
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 // -prodversionmin (shouldn't update if browser version too old) 2250 // -prodversionmin (shouldn't update if browser version too old)
2252 // -manifests & updates arriving out of order / interleaved 2251 // -manifests & updates arriving out of order / interleaved
2253 // -malformed update url (empty, file://, has query, has a # fragment, etc.) 2252 // -malformed update url (empty, file://, has query, has a # fragment, etc.)
2254 // -An extension gets uninstalled while updates are in progress (so it doesn't 2253 // -An extension gets uninstalled while updates are in progress (so it doesn't
2255 // "come back from the dead") 2254 // "come back from the dead")
2256 // -An extension gets manually updated to v3 while we're downloading v2 (ie 2255 // -An extension gets manually updated to v3 while we're downloading v2 (ie
2257 // you don't get downgraded accidentally) 2256 // you don't get downgraded accidentally)
2258 // -An update manifest mentions multiple updates 2257 // -An update manifest mentions multiple updates
2259 2258
2260 } // namespace extensions 2259 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/install_signer.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698