| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 NULL, | 101 NULL, |
| 102 NULL)); | 102 NULL)); |
| 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); | 111 false, // is_main_frame |
| 112 false, // parent_is_main_frame |
| 113 false); // is_async |
| 112 } | 114 } |
| 113 return request.Pass(); | 115 return request.Pass(); |
| 114 } | 116 } |
| 115 | 117 |
| 116 void SendResource(int resource_id) { | 118 void SendResource(int resource_id) { |
| 117 source()->SendResource(resource_id, callback_); | 119 source()->SendResource(resource_id, callback_); |
| 118 } | 120 } |
| 119 | 121 |
| 120 void SendJSWithOrigin( | 122 void SendJSWithOrigin( |
| 121 int resource_id, | 123 int resource_id, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 192 } |
| 191 | 193 |
| 192 TEST_F(IframeSourceTest, SendJSWithOrigin) { | 194 TEST_F(IframeSourceTest, SendJSWithOrigin) { |
| 193 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); | 195 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); |
| 194 EXPECT_FALSE(response_string().empty()); | 196 EXPECT_FALSE(response_string().empty()); |
| 195 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); | 197 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); |
| 196 EXPECT_FALSE(response_string().empty()); | 198 EXPECT_FALSE(response_string().empty()); |
| 197 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); | 199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); |
| 198 EXPECT_TRUE(response_string().empty()); | 200 EXPECT_TRUE(response_string().empty()); |
| 199 } | 201 } |
| OLD | NEW |