OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/webp_transcode/webp_network_client.h" | 5 #include "components/webp_transcode/webp_network_client.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Desktop Chrome default. | 53 // Desktop Chrome default. |
54 {"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," | 54 {"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," |
55 "*/*;q=0.8", | 55 "*/*;q=0.8", |
56 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," | 56 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," |
57 "*/*;q=0.8"}}; | 57 "*/*;q=0.8"}}; |
58 GURL url("http://www.google.com"); | 58 GURL url("http://www.google.com"); |
59 scoped_ptr<net::URLRequestContext> request_context( | 59 scoped_ptr<net::URLRequestContext> request_context( |
60 new net::TestURLRequestContext(false)); | 60 new net::TestURLRequestContext(false)); |
61 for (size_t i = 0; i < arraysize(tests); ++i) { | 61 for (size_t i = 0; i < arraysize(tests); ++i) { |
62 scoped_ptr<net::URLRequest> request = | 62 scoped_ptr<net::URLRequest> request = |
63 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, nullptr, | 63 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, nullptr); |
64 nullptr).Pass(); | |
65 if (!tests[i].header_in.empty()) | 64 if (!tests[i].header_in.empty()) |
66 request->SetExtraRequestHeaderByName("Accept", tests[i].header_in, true); | 65 request->SetExtraRequestHeaderByName("Accept", tests[i].header_in, true); |
67 [webp_client_ didCreateNativeRequest:request.get()]; | 66 [webp_client_ didCreateNativeRequest:request.get()]; |
68 const net::HttpRequestHeaders& headers = request->extra_request_headers(); | 67 const net::HttpRequestHeaders& headers = request->extra_request_headers(); |
69 std::string acceptHeader; | 68 std::string acceptHeader; |
70 EXPECT_TRUE(headers.GetHeader("Accept", &acceptHeader)); | 69 EXPECT_TRUE(headers.GetHeader("Accept", &acceptHeader)); |
71 EXPECT_EQ(tests[i].header_out, acceptHeader); | 70 EXPECT_EQ(tests[i].header_out, acceptHeader); |
72 } | 71 } |
73 } | 72 } |
OLD | NEW |