| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "chrome/browser/child_process_security_policy.h" | 10 #include "chrome/browser/child_process_security_policy.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 request.url = url; | 66 request.url = url; |
| 67 request.first_party_for_cookies = url; // bypass third-party cookie blocking | 67 request.first_party_for_cookies = url; // bypass third-party cookie blocking |
| 68 // init the rest to default values to prevent getting UMR. | 68 // init the rest to default values to prevent getting UMR. |
| 69 request.frame_origin = "null"; | 69 request.frame_origin = "null"; |
| 70 request.main_frame_origin = "null"; | 70 request.main_frame_origin = "null"; |
| 71 request.load_flags = 0; | 71 request.load_flags = 0; |
| 72 request.origin_child_id = 0; | 72 request.origin_child_id = 0; |
| 73 request.resource_type = type; | 73 request.resource_type = type; |
| 74 request.request_context = 0; | 74 request.request_context = 0; |
| 75 request.appcache_host_id = appcache::kNoHostId; | 75 request.appcache_host_id = appcache::kNoHostId; |
| 76 request.download_to_file = false; |
| 76 request.host_renderer_id = -1; | 77 request.host_renderer_id = -1; |
| 77 request.host_render_view_id = -1; | 78 request.host_render_view_id = -1; |
| 78 return request; | 79 return request; |
| 79 } | 80 } |
| 80 | 81 |
| 81 // Spin up the message loop to kick off the request. | 82 // Spin up the message loop to kick off the request. |
| 82 static void KickOffRequest() { | 83 static void KickOffRequest() { |
| 83 MessageLoop::current()->RunAllPending(); | 84 MessageLoop::current()->RunAllPending(); |
| 84 } | 85 } |
| 85 | 86 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 void CheckSuccessfulRequest(const std::vector<IPC::Message>& messages, | 303 void CheckSuccessfulRequest(const std::vector<IPC::Message>& messages, |
| 303 const std::string& reference_data) { | 304 const std::string& reference_data) { |
| 304 // A successful request will have received 4 messages: | 305 // A successful request will have received 4 messages: |
| 305 // ReceivedResponse (indicates headers received) | 306 // ReceivedResponse (indicates headers received) |
| 306 // DataReceived (data) | 307 // DataReceived (data) |
| 307 // XXX DataReceived (0 bytes remaining from a read) | 308 // XXX DataReceived (0 bytes remaining from a read) |
| 308 // RequestComplete (request is done) | 309 // RequestComplete (request is done) |
| 309 // | 310 // |
| 310 // This function verifies that we received 4 messages and that they | 311 // This function verifies that we received 4 messages and that they |
| 311 // are appropriate. | 312 // are appropriate. |
| 312 ASSERT_EQ(messages.size(), 3U); | 313 ASSERT_EQ(3U, messages.size()); |
| 313 | 314 |
| 314 // The first messages should be received response | 315 // The first messages should be received response |
| 315 ASSERT_EQ(ViewMsg_Resource_ReceivedResponse::ID, messages[0].type()); | 316 ASSERT_EQ(ViewMsg_Resource_ReceivedResponse::ID, messages[0].type()); |
| 316 | 317 |
| 317 // followed by the data, currently we only do the data in one chunk, but | 318 // followed by the data, currently we only do the data in one chunk, but |
| 318 // should probably test multiple chunks later | 319 // should probably test multiple chunks later |
| 319 ASSERT_EQ(ViewMsg_Resource_DataReceived::ID, messages[1].type()); | 320 ASSERT_EQ(ViewMsg_Resource_DataReceived::ID, messages[1].type()); |
| 320 | 321 |
| 321 void* iter = NULL; | 322 void* iter = NULL; |
| 322 int request_id; | 323 int request_id; |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); | 1023 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); |
| 1023 } | 1024 } |
| 1024 | 1025 |
| 1025 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { | 1026 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { |
| 1026 resource_type_ = ResourceType::MAIN_FRAME; | 1027 resource_type_ = ResourceType::MAIN_FRAME; |
| 1027 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, | 1028 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, |
| 1028 resource_type_, request_info_.get()); | 1029 resource_type_, request_info_.get()); |
| 1029 | 1030 |
| 1030 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); | 1031 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); |
| 1031 } | 1032 } |
| OLD | NEW |