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