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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 scoped_ptr<net::URLRequest> MockRequest( | 92 scoped_ptr<net::URLRequest> MockRequest( |
93 const std::string& url, | 93 const std::string& url, |
94 bool allocate_info, | 94 bool allocate_info, |
95 int render_process_id, | 95 int render_process_id, |
96 int render_frame_id) { | 96 int render_frame_id) { |
97 scoped_ptr<net::URLRequest> request( | 97 scoped_ptr<net::URLRequest> request( |
98 resource_context_.GetRequestContext()->CreateRequest( | 98 resource_context_.GetRequestContext()->CreateRequest( |
99 GURL(url), | 99 GURL(url), |
100 net::DEFAULT_PRIORITY, | 100 net::DEFAULT_PRIORITY, |
101 NULL, | |
102 NULL)); | 101 NULL)); |
103 if (allocate_info) { | 102 if (allocate_info) { |
104 content::ResourceRequestInfo::AllocateForTesting( | 103 content::ResourceRequestInfo::AllocateForTesting( |
105 request.get(), | 104 request.get(), |
106 content::RESOURCE_TYPE_SUB_FRAME, | 105 content::RESOURCE_TYPE_SUB_FRAME, |
107 &resource_context_, | 106 &resource_context_, |
108 render_process_id, | 107 render_process_id, |
109 render_frame_id, | 108 render_frame_id, |
110 MSG_ROUTING_NONE, | 109 MSG_ROUTING_NONE, |
111 false, // is_main_frame | 110 false, // is_main_frame |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 192 } |
194 | 193 |
195 TEST_F(IframeSourceTest, SendJSWithOrigin) { | 194 TEST_F(IframeSourceTest, SendJSWithOrigin) { |
196 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); | 195 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); |
197 EXPECT_FALSE(response_string().empty()); | 196 EXPECT_FALSE(response_string().empty()); |
198 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); | 197 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); |
199 EXPECT_FALSE(response_string().empty()); | 198 EXPECT_FALSE(response_string().empty()); |
200 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); | 199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); |
201 EXPECT_TRUE(response_string().empty()); | 200 EXPECT_TRUE(response_string().empty()); |
202 } | 201 } |
OLD | NEW |