OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Tests exercising the Chrome Plugin API. | 4 // Tests exercising the Chrome Plugin API. |
5 | 5 |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/chrome_plugin_host.h" | 9 #include "chrome/browser/chrome_plugin_host.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 // Note: we must add this task after we make the request, so that | 252 // Note: we must add this task after we make the request, so that |
253 // URLRequestTestJob's StartAsync task is added and run first. | 253 // URLRequestTestJob's StartAsync task is added and run first. |
254 MessageLoop::current()->PostTask(FROM_HERE, | 254 MessageLoop::current()->PostTask(FROM_HERE, |
255 NewRunnableFunction(&ProcessAllPendingMessages)); | 255 NewRunnableFunction(&ProcessAllPendingMessages)); |
256 MessageLoop::current()->Run(); | 256 MessageLoop::current()->Run(); |
257 } | 257 } |
258 | 258 |
259 // Tests that the plugin can issue a POST request. | 259 // Tests that the plugin can issue a POST request. |
260 TEST_F(ChromePluginTest, CanMakePOSTRequest) { | 260 TEST_F(ChromePluginTest, CanMakePOSTRequest) { |
261 scoped_refptr<HTTPTestServer> server = | 261 TestServer server(kDocRoot); |
262 HTTPTestServer::CreateServer(kDocRoot); | 262 GURL url = server.TestServerPage("echo"); |
263 ASSERT_TRUE(NULL != server.get()); | |
264 | |
265 GURL url = server->TestServerPage("echo"); | |
266 | 263 |
267 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); | 264 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); |
268 | 265 |
269 // Note: we must add this task after we make the request, so that | 266 // Note: we must add this task after we make the request, so that |
270 // URLRequestTestJob's StartAsync task is added and run first. | 267 // URLRequestTestJob's StartAsync task is added and run first. |
271 MessageLoop::current()->PostTask(FROM_HERE, | 268 MessageLoop::current()->PostTask(FROM_HERE, |
272 NewRunnableFunction(&ProcessAllPendingMessages)); | 269 NewRunnableFunction(&ProcessAllPendingMessages)); |
273 MessageLoop::current()->Run(); | 270 MessageLoop::current()->Run(); |
274 } | 271 } |
275 | 272 |
276 // Tests that the plugin does not intercept its own requests. | 273 // Tests that the plugin does not intercept its own requests. |
277 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { | 274 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { |
278 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; | 275 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; |
279 | 276 |
280 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( | 277 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( |
281 "GET", GURL(payload.url))); | 278 "GET", GURL(payload.url))); |
282 | 279 |
283 MessageLoop::current()->Run(); | 280 MessageLoop::current()->Run(); |
284 } | 281 } |
285 | 282 |
OLD | NEW |