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

Side by Side Diff: chrome/browser/policy/device_management_service_unittest.cc

Issue 8552002: net: Move UnescapeRule into the net namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 <ostream> 5 #include <ostream>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "chrome/browser/policy/device_management_backend_impl.h" 10 #include "chrome/browser/policy/device_management_backend_impl.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Simple query parameter parser for testing. 240 // Simple query parameter parser for testing.
241 class QueryParams { 241 class QueryParams {
242 public: 242 public:
243 explicit QueryParams(const std::string& query) { 243 explicit QueryParams(const std::string& query) {
244 base::SplitStringIntoKeyValuePairs(query, '=', '&', &params_); 244 base::SplitStringIntoKeyValuePairs(query, '=', '&', &params_);
245 } 245 }
246 246
247 bool Check(const std::string& name, const std::string& expected_value) { 247 bool Check(const std::string& name, const std::string& expected_value) {
248 bool found = false; 248 bool found = false;
249 for (ParamMap::const_iterator i(params_.begin()); i != params_.end(); ++i) { 249 for (ParamMap::const_iterator i(params_.begin()); i != params_.end(); ++i) {
250 std::string unescaped_name( 250 std::string unescaped_name(net::UnescapeURLComponent(
251 net::UnescapeURLComponent(i->first, 251 i->first,
252 UnescapeRule::NORMAL | 252 net::UnescapeRule::NORMAL |
253 UnescapeRule::SPACES | 253 net::UnescapeRule::SPACES |
254 UnescapeRule::URL_SPECIAL_CHARS | 254 net::UnescapeRule::URL_SPECIAL_CHARS |
255 UnescapeRule::CONTROL_CHARS | 255 net::UnescapeRule::CONTROL_CHARS |
256 UnescapeRule::REPLACE_PLUS_WITH_SPACE)); 256 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE));
257 if (unescaped_name == name) { 257 if (unescaped_name == name) {
258 if (found) 258 if (found)
259 return false; 259 return false;
260 found = true; 260 found = true;
261 std::string unescaped_value( 261 std::string unescaped_value(net::UnescapeURLComponent(
262 net::UnescapeURLComponent(i->second, 262 i->second,
263 UnescapeRule::NORMAL | 263 net::UnescapeRule::NORMAL |
264 UnescapeRule::SPACES | 264 net::UnescapeRule::SPACES |
265 UnescapeRule::URL_SPECIAL_CHARS | 265 net::UnescapeRule::URL_SPECIAL_CHARS |
266 UnescapeRule::CONTROL_CHARS | 266 net::UnescapeRule::CONTROL_CHARS |
267 UnescapeRule::REPLACE_PLUS_WITH_SPACE)); 267 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE));
268 if (unescaped_value != expected_value) 268 if (unescaped_value != expected_value)
269 return false; 269 return false;
270 } 270 }
271 } 271 }
272 return found; 272 return found;
273 } 273 }
274 274
275 private: 275 private:
276 typedef std::vector<std::pair<std::string, std::string> > ParamMap; 276 typedef std::vector<std::pair<std::string, std::string> > ParamMap;
277 ParamMap params_; 277 ParamMap params_;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 578
579 // Verify that a new URLFetcher was started that bypasses the proxy. 579 // Verify that a new URLFetcher was started that bypasses the proxy.
580 fetcher = factory_.GetFetcherByID(0); 580 fetcher = factory_.GetFetcherByID(0);
581 ASSERT_TRUE(fetcher); 581 ASSERT_TRUE(fetcher);
582 EXPECT_TRUE((fetcher->GetLoadFlags() & net::LOAD_BYPASS_PROXY) != 0); 582 EXPECT_TRUE((fetcher->GetLoadFlags() & net::LOAD_BYPASS_PROXY) != 0);
583 EXPECT_EQ(original_url, fetcher->GetOriginalURL()); 583 EXPECT_EQ(original_url, fetcher->GetOriginalURL());
584 EXPECT_EQ(upload_data, fetcher->upload_data()); 584 EXPECT_EQ(upload_data, fetcher->upload_data());
585 } 585 }
586 586
587 } // namespace policy 587 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/browser/safe_browsing/safe_browsing_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698