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

Side by Side Diff: net/url_request/url_request_test_util.cc

Issue 10068021: Fix file access on Chrome for ChromeOS on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload after sync Created 8 years, 7 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 | Annotate | Revision Log
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 "net/url_request/url_request_test_util.h" 5 #include "net/url_request/url_request_test_util.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 EXPECT_TRUE(next_states_[req_id] & kStageAuthRequired) << 486 EXPECT_TRUE(next_states_[req_id] & kStageAuthRequired) <<
487 event_order_[req_id]; 487 event_order_[req_id];
488 next_states_[req_id] = kStageBeforeSendHeaders | 488 next_states_[req_id] = kStageBeforeSendHeaders |
489 kStageHeadersReceived | // Request canceled by delegate simulates empty 489 kStageHeadersReceived | // Request canceled by delegate simulates empty
490 // response. 490 // response.
491 kStageResponseStarted | // data: URLs do not trigger sending headers 491 kStageResponseStarted | // data: URLs do not trigger sending headers
492 kStageBeforeRedirect; // a delegate can trigger a redirection 492 kStageBeforeRedirect; // a delegate can trigger a redirection
493 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; 493 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
494 } 494 }
495 495
496 bool TestNetworkDelegate::CanGetCookies(const net::URLRequest* request, 496 bool TestNetworkDelegate::CanGetCookiesInternal(
497 const net::CookieList& cookie_list) { 497 const net::URLRequest& request,
498 const net::CookieList& cookie_list) {
498 bool allow = true; 499 bool allow = true;
499 if (cookie_options_bit_mask_ & NO_GET_COOKIES) 500 if (cookie_options_bit_mask_ & NO_GET_COOKIES)
500 allow = false; 501 allow = false;
501 502
502 if (!allow) { 503 if (!allow) {
503 blocked_get_cookies_count_++; 504 blocked_get_cookies_count_++;
504 } 505 }
505 506
506 return allow; 507 return allow;
507 } 508 }
508 509
509 bool TestNetworkDelegate::CanSetCookie(const net::URLRequest* request, 510 bool TestNetworkDelegate::CanSetCookieInternal(const net::URLRequest& request,
510 const std::string& cookie_line, 511 const std::string& cookie_line,
511 net::CookieOptions* options) { 512 net::CookieOptions* options) {
512 bool allow = true; 513 bool allow = true;
513 if (cookie_options_bit_mask_ & NO_SET_COOKIE) 514 if (cookie_options_bit_mask_ & NO_SET_COOKIE)
514 allow = false; 515 allow = false;
515 516
516 if (cookie_options_bit_mask_ & FORCE_SESSION) 517 if (cookie_options_bit_mask_ & FORCE_SESSION)
517 options->set_force_session(); 518 options->set_force_session();
518 519
519 if (!allow) { 520 if (!allow) {
520 blocked_set_cookie_count_++; 521 blocked_set_cookie_count_++;
521 } else { 522 } else {
522 set_cookie_count_++; 523 set_cookie_count_++;
523 } 524 }
524 525
525 return allow; 526 return allow;
526 } 527 }
527 528
529 bool TestNetworkDelegate::CanAccessFileInternal(const net::URLRequest& request,
530 const FilePath& path) const {
531 return true;
532 }
533
528 // static 534 // static
529 std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1"); 535 std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1");
530 536
531 ScopedCustomUrlRequestTestHttpHost::ScopedCustomUrlRequestTestHttpHost( 537 ScopedCustomUrlRequestTestHttpHost::ScopedCustomUrlRequestTestHttpHost(
532 const std::string& new_value) 538 const std::string& new_value)
533 : old_value_(value_), 539 : old_value_(value_),
534 new_value_(new_value) { 540 new_value_(new_value) {
535 value_ = new_value_; 541 value_ = new_value_;
536 } 542 }
537 543
538 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { 544 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() {
539 DCHECK_EQ(value_, new_value_); 545 DCHECK_EQ(value_, new_value_);
540 value_ = old_value_; 546 value_ = old_value_;
541 } 547 }
542 548
543 // static 549 // static
544 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { 550 const std::string& ScopedCustomUrlRequestTestHttpHost::value() {
545 return value_; 551 return value_;
546 } 552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698