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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 const std::string& url, | 97 const std::string& url, |
98 bool allocate_info, | 98 bool allocate_info, |
99 int render_process_id, | 99 int render_process_id, |
100 int render_frame_id) { | 100 int render_frame_id) { |
101 net::URLRequest* request = | 101 net::URLRequest* request = |
102 new net::URLRequest(GURL(url), | 102 new net::URLRequest(GURL(url), |
103 net::DEFAULT_PRIORITY, | 103 net::DEFAULT_PRIORITY, |
104 NULL, | 104 NULL, |
105 resource_context_.GetRequestContext()); | 105 resource_context_.GetRequestContext()); |
106 if (allocate_info) { | 106 if (allocate_info) { |
107 content::ResourceRequestInfo::AllocateForTesting(request, | 107 content::ResourceRequestInfo::AllocateForTesting( |
108 ResourceType::SUB_FRAME, | 108 request, |
109 &resource_context_, | 109 content::RESOURCE_TYPE_SUB_FRAME, |
110 render_process_id, | 110 &resource_context_, |
111 render_frame_id, | 111 render_process_id, |
112 MSG_ROUTING_NONE, | 112 render_frame_id, |
113 false); | 113 MSG_ROUTING_NONE, |
| 114 false); |
114 } | 115 } |
115 return request; | 116 return request; |
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( |
123 int resource_id, | 124 int resource_id, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 195 } |
195 | 196 |
196 TEST_F(IframeSourceTest, SendJSWithOrigin) { | 197 TEST_F(IframeSourceTest, SendJSWithOrigin) { |
197 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); | 198 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); |
198 EXPECT_FALSE(response_string().empty()); | 199 EXPECT_FALSE(response_string().empty()); |
199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); | 200 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); |
200 EXPECT_FALSE(response_string().empty()); | 201 EXPECT_FALSE(response_string().empty()); |
201 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); | 202 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); |
202 EXPECT_TRUE(response_string().empty()); | 203 EXPECT_TRUE(response_string().empty()); |
203 } | 204 } |
OLD | NEW |