diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 22:51:15 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 22:51:15 +0000 |
commit | 85a37afd0c15594949e427d507330f424410bcc5 (patch) | |
tree | ae8a7fd9a8dfcef7cd3ac5e5fc3fb9c9a61a9a35 /webkit/media/test_response_generator.cc | |
parent | aa452e9df9d9f710d239ecd716796c80c7f93174 (diff) | |
download | chromium_src-85a37afd0c15594949e427d507330f424410bcc5.zip chromium_src-85a37afd0c15594949e427d507330f424410bcc5.tar.gz chromium_src-85a37afd0c15594949e427d507330f424410bcc5.tar.bz2 |
Move webkit/media/ into webkit/renderer/media
This code is only used in renderer processes, this just moves the files
to reflect that fact in the directory structure so we can verify it
with DEPS.
BUG=237267
Review URL: https://chromiumcodereview.appspot.com/15842010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/media/test_response_generator.cc')
-rw-r--r-- | webkit/media/test_response_generator.cc | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/webkit/media/test_response_generator.cc b/webkit/media/test_response_generator.cc deleted file mode 100644 index ae5aeaf2..0000000 --- a/webkit/media/test_response_generator.cc +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/media/test_response_generator.h" - -#include "base/format_macros.h" -#include "base/stringprintf.h" -#include "base/strings/string_number_conversions.h" -#include "net/base/net_errors.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebURLResponse.h" - -using WebKit::WebString; -using WebKit::WebURLError; -using WebKit::WebURLResponse; - -namespace webkit_media { - -TestResponseGenerator::TestResponseGenerator(const GURL& gurl, - int64 content_length) - : gurl_(gurl), - content_length_(content_length) { -} - -WebURLError TestResponseGenerator::GenerateError() { - WebURLError error; - error.reason = net::ERR_ABORTED; - error.domain = WebString::fromUTF8(net::kErrorDomain); - return error; -} - -WebURLResponse TestResponseGenerator::Generate200() { - WebURLResponse response(gurl_); - response.setHTTPStatusCode(200); - - response.setHTTPHeaderField( - WebString::fromUTF8("Content-Length"), - WebString::fromUTF8(base::Int64ToString(content_length_))); - response.setExpectedContentLength(content_length_); - return response; -} - -WebURLResponse TestResponseGenerator::Generate206(int64 first_byte_offset) { - return Generate206(first_byte_offset, kNormal); -} - -WebURLResponse TestResponseGenerator::Generate206(int64 first_byte_offset, - Flags flags) { - int64 range_content_length = content_length_ - first_byte_offset; - int64 last_byte_offset = content_length_ - 1; - - WebURLResponse response(gurl_); - response.setHTTPStatusCode(206); - - if ((flags & kNoAcceptRanges) == 0) { - response.setHTTPHeaderField(WebString::fromUTF8("Accept-Ranges"), - WebString::fromUTF8("bytes")); - } - - if ((flags & kNoContentRange) == 0) { - std::string content_range = base::StringPrintf( - "bytes %" PRId64 "-%" PRId64 "/", - first_byte_offset, last_byte_offset); - if (flags & kNoContentRangeInstanceSize) - content_range += "*"; - else - content_range += base::StringPrintf("%" PRId64, content_length_); - response.setHTTPHeaderField(WebString::fromUTF8("Content-Range"), - WebString::fromUTF8(content_range)); - } - - if ((flags & kNoContentLength) == 0) { - response.setHTTPHeaderField( - WebString::fromUTF8("Content-Length"), - WebString::fromUTF8(base::Int64ToString(range_content_length))); - response.setExpectedContentLength(range_content_length); - } - return response; -} - -WebURLResponse TestResponseGenerator::Generate404() { - WebURLResponse response(gurl_); - response.setHTTPStatusCode(404); - return response; -} - -WebURLResponse TestResponseGenerator::GenerateFileResponse( - int64 first_byte_offset) { - WebURLResponse response(gurl_); - response.setHTTPStatusCode(0); - - if (first_byte_offset >= 0) { - response.setExpectedContentLength(content_length_ - first_byte_offset); - } else { - response.setExpectedContentLength(-1); - } - return response; -} - -} // namespace webkit_media |