OLD | NEW |
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 <ostream> | 5 #include <ostream> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 | 330 |
331 bool Check(const std::string& name, const std::string& expected_value) { | 331 bool Check(const std::string& name, const std::string& expected_value) { |
332 bool found = false; | 332 bool found = false; |
333 for (ParamMap::const_iterator i(params_.begin()); i != params_.end(); ++i) { | 333 for (ParamMap::const_iterator i(params_.begin()); i != params_.end(); ++i) { |
334 std::string unescaped_name(net::UnescapeURLComponent( | 334 std::string unescaped_name(net::UnescapeURLComponent( |
335 i->first, | 335 i->first, |
336 net::UnescapeRule::NORMAL | | 336 net::UnescapeRule::NORMAL | |
337 net::UnescapeRule::SPACES | | 337 net::UnescapeRule::SPACES | |
338 net::UnescapeRule::URL_SPECIAL_CHARS | | 338 net::UnescapeRule::URL_SPECIAL_CHARS | |
339 net::UnescapeRule::CONTROL_CHARS | | 339 net::UnescapeRule::SPOOFING_AND_CONTROL_CHARS | |
340 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE)); | 340 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE)); |
341 if (unescaped_name == name) { | 341 if (unescaped_name == name) { |
342 if (found) | 342 if (found) |
343 return false; | 343 return false; |
344 found = true; | 344 found = true; |
345 std::string unescaped_value(net::UnescapeURLComponent( | 345 std::string unescaped_value(net::UnescapeURLComponent( |
346 i->second, | 346 i->second, |
347 net::UnescapeRule::NORMAL | | 347 net::UnescapeRule::NORMAL | |
348 net::UnescapeRule::SPACES | | 348 net::UnescapeRule::SPACES | |
349 net::UnescapeRule::URL_SPECIAL_CHARS | | 349 net::UnescapeRule::URL_SPECIAL_CHARS | |
350 net::UnescapeRule::CONTROL_CHARS | | 350 net::UnescapeRule::SPOOFING_AND_CONTROL_CHARS | |
351 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE)); | 351 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE)); |
352 if (unescaped_value != expected_value) | 352 if (unescaped_value != expected_value) |
353 return false; | 353 return false; |
354 } | 354 } |
355 } | 355 } |
356 return found; | 356 return found; |
357 } | 357 } |
358 | 358 |
359 private: | 359 private: |
360 typedef base::StringPairs ParamMap; | 360 typedef base::StringPairs ParamMap; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 EXPECT_CALL(*this, OnJobDone(DM_STATUS_REQUEST_FAILED, _, _)); | 691 EXPECT_CALL(*this, OnJobDone(DM_STATUS_REQUEST_FAILED, _, _)); |
692 EXPECT_CALL(*this, OnJobRetry(_)).Times(0); | 692 EXPECT_CALL(*this, OnJobRetry(_)).Times(0); |
693 fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 693 fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
694 net::ERR_NETWORK_CHANGED)); | 694 net::ERR_NETWORK_CHANGED)); |
695 fetcher->set_url(GURL(kServiceUrl)); | 695 fetcher->set_url(GURL(kServiceUrl)); |
696 fetcher->delegate()->OnURLFetchComplete(fetcher); | 696 fetcher->delegate()->OnURLFetchComplete(fetcher); |
697 Mock::VerifyAndClearExpectations(this); | 697 Mock::VerifyAndClearExpectations(this); |
698 } | 698 } |
699 | 699 |
700 } // namespace policy | 700 } // namespace policy |
OLD | NEW |