Chromium Code Reviews| Index: webkit/glue/media/buffered_resource_loader_unittest.cc |
| =================================================================== |
| --- webkit/glue/media/buffered_resource_loader_unittest.cc (revision 88518) |
| +++ webkit/glue/media/buffered_resource_loader_unittest.cc (working copy) |
| @@ -7,10 +7,12 @@ |
| #include "base/format_macros.h" |
| #include "base/stringprintf.h" |
| #include "net/base/net_errors.h" |
| +#include "net/http/http_request_headers.h" |
| #include "net/http/http_util.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| #include "webkit/glue/media/buffered_resource_loader.h" |
| @@ -30,6 +32,7 @@ |
| using ::testing::ReturnRef; |
| using ::testing::SetArgumentPointee; |
| using ::testing::StrictMock; |
| +using ::testing::Truly; |
| using ::testing::NiceMock; |
| using ::testing::WithArgs; |
| @@ -65,6 +68,13 @@ |
| loader->didFail(NULL, error); |
| } |
| +// Predicate that tests that request disallows compressed data. |
| +static bool CorrectAcceptEncoding(const WebKit::WebURLRequest &request) { |
| + WebKit::WebString value = request.httpHeaderField( |
| + WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)); |
| + return value == WebString::fromUTF8("identity;q=1, *;q=0"); |
|
Alpha Left Google
2011/06/09 20:30:25
Check the exact string in the implementation is to
enal
2011/06/09 21:55:03
Done.
|
| +} |
| + |
| class BufferedResourceLoaderTest : public testing::Test { |
| public: |
| BufferedResourceLoaderTest() |
| @@ -98,7 +108,8 @@ |
| void Start() { |
| InSequence s; |
| - EXPECT_CALL(*url_loader_, loadAsynchronously(_, loader_.get())); |
| + EXPECT_CALL(*url_loader_, loadAsynchronously(Truly(CorrectAcceptEncoding), |
| + loader_.get())); |
| loader_->Start( |
| NewCallback(this, &BufferedResourceLoaderTest::StartCallback), |
| NewCallback(this, &BufferedResourceLoaderTest::NetworkCallback), |