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

Side by Side Diff: media/blink/test_response_generator.cc

Issue 2078833003: fix a semi-rare crash in multibuffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 6 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 | « media/blink/test_response_generator.h ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/blink/test_response_generator.h" 5 #include "media/blink/test_response_generator.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 if ((flags & kNoContentLength) == 0) { 82 if ((flags & kNoContentLength) == 0) {
83 response.setHTTPHeaderField( 83 response.setHTTPHeaderField(
84 WebString::fromUTF8("Content-Length"), 84 WebString::fromUTF8("Content-Length"),
85 WebString::fromUTF8(base::Int64ToString(range_content_length))); 85 WebString::fromUTF8(base::Int64ToString(range_content_length)));
86 response.setExpectedContentLength(range_content_length); 86 response.setExpectedContentLength(range_content_length);
87 } 87 }
88 return response; 88 return response;
89 } 89 }
90 90
91 WebURLResponse TestResponseGenerator::GenerateResponse(int code) {
92 WebURLResponse response(gurl_);
93 response.setHTTPStatusCode(code);
94 return response;
95 }
96
91 WebURLResponse TestResponseGenerator::Generate404() { 97 WebURLResponse TestResponseGenerator::Generate404() {
92 WebURLResponse response(gurl_); 98 return GenerateResponse(404);
93 response.setHTTPStatusCode(404);
94 return response;
95 } 99 }
96 100
97 WebURLResponse TestResponseGenerator::GenerateFileResponse( 101 WebURLResponse TestResponseGenerator::GenerateFileResponse(
98 int64_t first_byte_offset) { 102 int64_t first_byte_offset) {
99 WebURLResponse response(gurl_); 103 WebURLResponse response(gurl_);
100 response.setHTTPStatusCode(0); 104 response.setHTTPStatusCode(0);
101 105
102 if (first_byte_offset >= 0) { 106 if (first_byte_offset >= 0) {
103 response.setExpectedContentLength(content_length_ - first_byte_offset); 107 response.setExpectedContentLength(content_length_ - first_byte_offset);
104 } else { 108 } else {
105 response.setExpectedContentLength(-1); 109 response.setExpectedContentLength(-1);
106 } 110 }
107 return response; 111 return response;
108 } 112 }
109 113
110 } // namespace media 114 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/test_response_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698