OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/process.h" | 8 #include "base/process.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "chrome/common/filter_policy.h" | 10 #include "chrome/common/filter_policy.h" |
| 11 #include "chrome/common/render_messages.h" |
11 #include "chrome/common/resource_dispatcher.h" | 12 #include "chrome/common/resource_dispatcher.h" |
12 | 13 |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 using webkit_glue::ResourceLoaderBridge; | 16 using webkit_glue::ResourceLoaderBridge; |
16 | 17 |
17 static const char test_page_url[] = "http://www.google.com/"; | 18 static const char test_page_url[] = "http://www.google.com/"; |
18 static const char test_page_headers[] = | 19 static const char test_page_headers[] = |
19 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; | 20 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; |
20 static const char test_page_mime_type[] = "text/html"; | 21 static const char test_page_mime_type[] = "text/html"; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 int request_id; | 87 int request_id; |
87 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request_id)); | 88 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request_id)); |
88 | 89 |
89 ViewHostMsg_Resource_Request request; | 90 ViewHostMsg_Resource_Request request; |
90 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request)); | 91 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request)); |
91 | 92 |
92 // check values | 93 // check values |
93 EXPECT_EQ(test_page_url, request.url.spec()); | 94 EXPECT_EQ(test_page_url, request.url.spec()); |
94 | 95 |
95 // received response message | 96 // received response message |
96 ViewMsg_Resource_ResponseHead response; | 97 ResourceResponseHead response; |
97 std::string raw_headers(test_page_headers); | 98 std::string raw_headers(test_page_headers); |
98 std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); | 99 std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); |
99 response.headers = new net::HttpResponseHeaders(raw_headers); | 100 response.headers = new net::HttpResponseHeaders(raw_headers); |
100 response.mime_type = test_page_mime_type; | 101 response.mime_type = test_page_mime_type; |
101 response.charset = test_page_charset; | 102 response.charset = test_page_charset; |
102 response.filter_policy = FilterPolicy::DONT_FILTER; | 103 response.filter_policy = FilterPolicy::DONT_FILTER; |
103 dispatcher_->OnReceivedResponse(request_id, response); | 104 dispatcher_->OnReceivedResponse(request_id, response); |
104 | 105 |
105 // received data message with the test contents | 106 // received data message with the test contents |
106 base::SharedMemory shared_mem; | 107 base::SharedMemory shared_mem; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 179 } |
179 | 180 |
180 TEST_F(ResourceDispatcherTest, Cookies) { | 181 TEST_F(ResourceDispatcherTest, Cookies) { |
181 // FIXME | 182 // FIXME |
182 } | 183 } |
183 | 184 |
184 TEST_F(ResourceDispatcherTest, SerializedPostData) { | 185 TEST_F(ResourceDispatcherTest, SerializedPostData) { |
185 // FIXME | 186 // FIXME |
186 } | 187 } |
187 | 188 |
OLD | NEW |