| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 static bool CorrectAcceptEncoding(const blink::WebURLRequest &request) { | 57 static bool CorrectAcceptEncoding(const blink::WebURLRequest &request) { |
| 58 std::string value = request.httpHeaderField( | 58 std::string value = request.httpHeaderField( |
| 59 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)).utf8(); | 59 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)).utf8(); |
| 60 return (value.find("identity;q=1") != std::string::npos) && | 60 return (value.find("identity;q=1") != std::string::npos) && |
| 61 (value.find("*;q=0") != std::string::npos); | 61 (value.find("*;q=0") != std::string::npos); |
| 62 } | 62 } |
| 63 | 63 |
| 64 class BufferedResourceLoaderTest : public testing::Test { | 64 class BufferedResourceLoaderTest : public testing::Test { |
| 65 public: | 65 public: |
| 66 BufferedResourceLoaderTest() | 66 BufferedResourceLoaderTest() |
| 67 : view_(WebView::create(NULL)), frame_(WebLocalFrame::create(&client_)) { | 67 : view_(WebView::create(NULL)), |
| 68 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, |
| 69 &client_)) { |
| 68 view_->setMainFrame(frame_); | 70 view_->setMainFrame(frame_); |
| 69 | 71 |
| 70 for (int i = 0; i < kDataSize; ++i) { | 72 for (int i = 0; i < kDataSize; ++i) { |
| 71 data_[i] = i; | 73 data_[i] = i; |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 | 76 |
| 75 virtual ~BufferedResourceLoaderTest() { | 77 virtual ~BufferedResourceLoaderTest() { |
| 76 view_->close(); | 78 view_->close(); |
| 77 frame_->close(); | 79 frame_->close(); |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 | 1152 |
| 1151 // As soon as we have received enough data to fulfill the read, defer. | 1153 // As soon as we have received enough data to fulfill the read, defer. |
| 1152 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); | 1154 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); |
| 1153 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); | 1155 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); |
| 1154 WriteLoader(19, 1); | 1156 WriteLoader(19, 1); |
| 1155 VerifyBuffer(buffer, 10, 10); | 1157 VerifyBuffer(buffer, 10, 10); |
| 1156 EXPECT_FALSE(HasActiveLoader()); | 1158 EXPECT_FALSE(HasActiveLoader()); |
| 1157 } | 1159 } |
| 1158 | 1160 |
| 1159 } // namespace media | 1161 } // namespace media |
| OLD | NEW |