| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/search/iframe_source.h" | 5 #include "chrome/browser/search/iframe_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (allocate_info) { | 103 if (allocate_info) { |
| 104 content::ResourceRequestInfo::AllocateForTesting( | 104 content::ResourceRequestInfo::AllocateForTesting( |
| 105 request.get(), | 105 request.get(), |
| 106 content::RESOURCE_TYPE_SUB_FRAME, | 106 content::RESOURCE_TYPE_SUB_FRAME, |
| 107 &resource_context_, | 107 &resource_context_, |
| 108 render_process_id, | 108 render_process_id, |
| 109 render_frame_id, | 109 render_frame_id, |
| 110 MSG_ROUTING_NONE, | 110 MSG_ROUTING_NONE, |
| 111 false, // is_main_frame | 111 false, // is_main_frame |
| 112 false, // parent_is_main_frame | 112 false, // parent_is_main_frame |
| 113 true, // allow_download |
| 113 false); // is_async | 114 false); // is_async |
| 114 } | 115 } |
| 115 return request.Pass(); | 116 return request.Pass(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 void SendResource(int resource_id) { | 119 void SendResource(int resource_id) { |
| 119 source()->SendResource(resource_id, callback_); | 120 source()->SendResource(resource_id, callback_); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void SendJSWithOrigin( | 123 void SendJSWithOrigin( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 193 } |
| 193 | 194 |
| 194 TEST_F(IframeSourceTest, SendJSWithOrigin) { | 195 TEST_F(IframeSourceTest, SendJSWithOrigin) { |
| 195 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); | 196 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); |
| 196 EXPECT_FALSE(response_string().empty()); | 197 EXPECT_FALSE(response_string().empty()); |
| 197 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); | 198 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); |
| 198 EXPECT_FALSE(response_string().empty()); | 199 EXPECT_FALSE(response_string().empty()); |
| 199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); | 200 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); |
| 200 EXPECT_TRUE(response_string().empty()); | 201 EXPECT_TRUE(response_string().empty()); |
| 201 } | 202 } |
| OLD | NEW |