OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "content/common/request_extra_data.h" | 12 #include "content/common/request_extra_data.h" |
13 #include "content/common/resource_dispatcher.h" | 13 #include "content/common/resource_dispatcher.h" |
14 #include "content/common/resource_messages.h" | 14 #include "content/common/resource_messages.h" |
15 #include "content/public/common/resource_response.h" | 15 #include "content/public/common/resource_response.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/base/upload_data.h" | 17 #include "net/base/upload_data.h" |
18 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "webkit/appcache/appcache_interfaces.h" | 20 #include "webkit/appcache/appcache_interfaces.h" |
21 | 21 |
22 using webkit_glue::ResourceLoaderBridge; | 22 using webkit_glue::ResourceLoaderBridge; |
23 using webkit_glue::ResourceResponseInfo; | 23 using webkit_glue::ResourceResponseInfo; |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 static const char test_page_url[] = "http://www.google.com/"; | 27 static const char test_page_url[] = "http://www.google.com/"; |
28 static const char test_page_headers[] = | 28 static const char test_page_headers[] = |
29 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; | 29 "HTTP/1.1 200 OK\nContent-Type:text/html\nContent-Language:en\n\n"; |
30 static const char test_page_mime_type[] = "text/html"; | 30 static const char test_page_mime_type[] = "text/html"; |
31 static const char test_page_charset[] = ""; | 31 static const char test_page_charset[] = ""; |
32 static const char test_page_contents[] = | 32 static const char test_page_contents[] = |
33 "<html><head><title>Google</title></head><body><h1>Google</h1></body></html>"; | 33 "<html><head><title>Google</title></head><body><h1>Google</h1></body></html>"; |
34 static const uint32 test_page_contents_len = arraysize(test_page_contents) - 1; | 34 static const uint32 test_page_contents_len = arraysize(test_page_contents) - 1; |
35 | 35 |
36 static const char kShmemSegmentName[] = "DeferredResourceLoaderTest"; | 36 static const char kShmemSegmentName[] = "DeferredResourceLoaderTest"; |
37 | 37 |
38 // Listens for request response data and stores it so that it can be compared | 38 // Listens for request response data and stores it so that it can be compared |
39 // to the reference data. | 39 // to the reference data. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 bridge->Start(&callback); | 198 bridge->Start(&callback); |
199 | 199 |
200 ProcessMessages(); | 200 ProcessMessages(); |
201 | 201 |
202 // FIXME(brettw) when the request complete messages are actually handledo | 202 // FIXME(brettw) when the request complete messages are actually handledo |
203 // and dispatched, uncomment this. | 203 // and dispatched, uncomment this. |
204 //EXPECT_TRUE(callback.complete()); | 204 //EXPECT_TRUE(callback.complete()); |
205 //EXPECT_STREQ(test_page_contents, callback.data().c_str()); | 205 //EXPECT_STREQ(test_page_contents, callback.data().c_str()); |
206 //EXPECT_EQ(test_page_contents_len, callback.total_encoded_data_length()); | 206 //EXPECT_EQ(test_page_contents_len, callback.total_encoded_data_length()); |
| 207 //EXPECT_EQ(document.m_contentLanguage, "en") |
207 | 208 |
208 delete bridge; | 209 delete bridge; |
209 } | 210 } |
210 | 211 |
211 // Tests that the request IDs are straight when there are multiple requests. | 212 // Tests that the request IDs are straight when there are multiple requests. |
212 TEST_F(ResourceDispatcherTest, MultipleRequests) { | 213 TEST_F(ResourceDispatcherTest, MultipleRequests) { |
213 // FIXME | 214 // FIXME |
214 } | 215 } |
215 | 216 |
216 // Tests that the cancel method prevents other messages from being received | 217 // Tests that the cancel method prevents other messages from being received |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 ResourceResponseHead response_head; | 429 ResourceResponseHead response_head; |
429 response_head.error_code = net::OK; | 430 response_head.error_code = net::OK; |
430 | 431 |
431 PerformTest(response_head); | 432 PerformTest(response_head); |
432 | 433 |
433 EXPECT_EQ(0, response_info().load_timing.base_ticks.ToInternalValue()); | 434 EXPECT_EQ(0, response_info().load_timing.base_ticks.ToInternalValue()); |
434 EXPECT_EQ(-1, response_info().load_timing.dns_start); | 435 EXPECT_EQ(-1, response_info().load_timing.dns_start); |
435 } | 436 } |
436 | 437 |
437 } // namespace content | 438 } // namespace content |
OLD | NEW |