| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 static bool CorrectAcceptEncoding(const blink::WebURLRequest &request) { | 60 static bool CorrectAcceptEncoding(const blink::WebURLRequest &request) { |
| 61 std::string value = request.httpHeaderField( | 61 std::string value = request.httpHeaderField( |
| 62 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)).utf8(); | 62 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)).utf8(); |
| 63 return (value.find("identity;q=1") != std::string::npos) && | 63 return (value.find("identity;q=1") != std::string::npos) && |
| 64 (value.find("*;q=0") != std::string::npos); | 64 (value.find("*;q=0") != std::string::npos); |
| 65 } | 65 } |
| 66 | 66 |
| 67 class BufferedResourceLoaderTest : public testing::Test { | 67 class BufferedResourceLoaderTest : public testing::Test { |
| 68 public: | 68 public: |
| 69 BufferedResourceLoaderTest() | 69 BufferedResourceLoaderTest() |
| 70 : view_(WebView::create(NULL)), | 70 : view_(WebView::create(nullptr, true)), |
| 71 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, | 71 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, |
| 72 &client_)) { | 72 &client_)) { |
| 73 view_->setMainFrame(frame_); | 73 view_->setMainFrame(frame_); |
| 74 | 74 |
| 75 for (int i = 0; i < kDataSize; ++i) { | 75 for (int i = 0; i < kDataSize; ++i) { |
| 76 data_[i] = i; | 76 data_[i] = i; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 virtual ~BufferedResourceLoaderTest() { | 80 virtual ~BufferedResourceLoaderTest() { |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 | 1163 |
| 1164 // As soon as we have received enough data to fulfill the read, defer. | 1164 // As soon as we have received enough data to fulfill the read, defer. |
| 1165 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); | 1165 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); |
| 1166 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); | 1166 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); |
| 1167 WriteLoader(19, 1); | 1167 WriteLoader(19, 1); |
| 1168 VerifyBuffer(buffer, 10, 10); | 1168 VerifyBuffer(buffer, 10, 10); |
| 1169 EXPECT_FALSE(HasActiveLoader()); | 1169 EXPECT_FALSE(HasActiveLoader()); |
| 1170 } | 1170 } |
| 1171 | 1171 |
| 1172 } // namespace media | 1172 } // namespace media |
| OLD | NEW |