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/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/chrome_plugin_host.h" | 10 #include "chrome/browser/chrome_plugin_host.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 // Note: we must add this task after we make the request, so that | 272 // Note: we must add this task after we make the request, so that |
273 // URLRequestTestJob's StartAsync task is added and run first. | 273 // URLRequestTestJob's StartAsync task is added and run first. |
274 MessageLoop::current()->PostTask(FROM_HERE, | 274 MessageLoop::current()->PostTask(FROM_HERE, |
275 NewRunnableFunction(&ProcessAllPendingMessages)); | 275 NewRunnableFunction(&ProcessAllPendingMessages)); |
276 MessageLoop::current()->Run(); | 276 MessageLoop::current()->Run(); |
277 } | 277 } |
278 | 278 |
279 // Tests that the plugin can issue a POST request. | 279 // Tests that the plugin can issue a POST request. |
280 TEST_F(ChromePluginTest, CanMakePOSTRequest) { | 280 TEST_F(ChromePluginTest, CanMakePOSTRequest) { |
281 scoped_refptr<HTTPTestServer> server = | 281 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
282 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
283 ASSERT_TRUE(NULL != server.get()); | 282 ASSERT_TRUE(NULL != server.get()); |
284 | 283 |
285 GURL url = server->TestServerPage("echo"); | 284 GURL url = server->TestServerPage("echo"); |
286 | 285 |
287 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); | 286 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); |
288 | 287 |
289 // Note: we must add this task after we make the request, so that | 288 // Note: we must add this task after we make the request, so that |
290 // URLRequestTestJob's StartAsync task is added and run first. | 289 // URLRequestTestJob's StartAsync task is added and run first. |
291 MessageLoop::current()->PostTask(FROM_HERE, | 290 MessageLoop::current()->PostTask(FROM_HERE, |
292 NewRunnableFunction(&ProcessAllPendingMessages)); | 291 NewRunnableFunction(&ProcessAllPendingMessages)); |
293 MessageLoop::current()->Run(); | 292 MessageLoop::current()->Run(); |
294 } | 293 } |
295 | 294 |
296 // Tests that the plugin does not intercept its own requests. | 295 // Tests that the plugin does not intercept its own requests. |
297 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { | 296 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { |
298 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; | 297 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; |
299 | 298 |
300 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( | 299 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( |
301 "GET", GURL(payload.url))); | 300 "GET", GURL(payload.url))); |
302 | 301 |
303 MessageLoop::current()->Run(); | 302 MessageLoop::current()->Run(); |
304 } | 303 } |
305 | 304 |
306 } // namespace | 305 } // namespace |
OLD | NEW |