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

Side by Side Diff: content/test/net/url_request_abort_on_end_job.cc

Issue 1010963002: favor DCHECK_CURRENTLY_ON for better logs in content/{public,shell,test}/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 9 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 | « content/shell/browser/shell_url_request_context_getter.cc ('k') | no next file » | 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 // This class simulates what wininet does when a dns lookup fails. 4 // This class simulates what wininet does when a dns lookup fails.
5 5
6 #include <algorithm> 6 #include <algorithm>
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/test/net/url_request_abort_on_end_job.h" 12 #include "content/test/net/url_request_abort_on_end_job.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/http/http_response_headers.h" 15 #include "net/http/http_response_headers.h"
16 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_filter.h" 17 #include "net/url_request/url_request_filter.h"
18 #include "net/url_request/url_request_status.h" 18 #include "net/url_request/url_request_status.h"
19 19
20 namespace content { 20 namespace content {
21 namespace { 21 namespace {
22 22
23 const char kPageContent[] = "some data\r\n"; 23 const char kPageContent[] = "some data\r\n";
24 24
25 net::URLRequestJob* JobFactory( 25 net::URLRequestJob* JobFactory(
26 net::URLRequest* request, 26 net::URLRequest* request,
27 net::NetworkDelegate* network_delegate, 27 net::NetworkDelegate* network_delegate,
28 const std::string& scheme) { 28 const std::string& scheme) {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 29 DCHECK_CURRENTLY_ON(BrowserThread::IO);
30 return new URLRequestAbortOnEndJob(request, network_delegate); 30 return new URLRequestAbortOnEndJob(request, network_delegate);
31 } 31 }
32 32
33 void AddUrlHandlerOnIOThread() { 33 void AddUrlHandlerOnIOThread() {
34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 34 DCHECK_CURRENTLY_ON(BrowserThread::IO);
35 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 35 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
36 filter->AddUrlHandler(GURL(URLRequestAbortOnEndJob::k400AbortOnEndUrl), 36 filter->AddUrlHandler(GURL(URLRequestAbortOnEndJob::k400AbortOnEndUrl),
37 &JobFactory); 37 &JobFactory);
38 } 38 }
39 39
40 } // anonymous namespace 40 } // anonymous namespace
41 41
42 const char URLRequestAbortOnEndJob::k400AbortOnEndUrl[] = 42 const char URLRequestAbortOnEndJob::k400AbortOnEndUrl[] =
43 "http://url.handled.by.abort.on.end/400"; 43 "http://url.handled.by.abort.on.end/400";
44 44
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return true; 107 return true;
108 } 108 }
109 109
110 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, 110 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED,
111 net::ERR_CONNECTION_ABORTED)); 111 net::ERR_CONNECTION_ABORTED));
112 *bytes_read = -1; 112 *bytes_read = -1;
113 return false; 113 return false;
114 } 114 }
115 115
116 } // namespace content 116 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_url_request_context_getter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698