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 TestServer server(kDocRoot); | 261 scoped_refptr<HTTPTestServer> server = |
262 GURL url = server.TestServerPage("echo"); | 262 HTTPTestServer::CreateServer(kDocRoot); |
| 263 ASSERT_TRUE(NULL != server.get()); |
| 264 |
| 265 GURL url = server->TestServerPage("echo"); |
263 | 266 |
264 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); | 267 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); |
265 | 268 |
266 // Note: we must add this task after we make the request, so that | 269 // Note: we must add this task after we make the request, so that |
267 // URLRequestTestJob's StartAsync task is added and run first. | 270 // URLRequestTestJob's StartAsync task is added and run first. |
268 MessageLoop::current()->PostTask(FROM_HERE, | 271 MessageLoop::current()->PostTask(FROM_HERE, |
269 NewRunnableFunction(&ProcessAllPendingMessages)); | 272 NewRunnableFunction(&ProcessAllPendingMessages)); |
270 MessageLoop::current()->Run(); | 273 MessageLoop::current()->Run(); |
271 } | 274 } |
272 | 275 |
273 // Tests that the plugin does not intercept its own requests. | 276 // Tests that the plugin does not intercept its own requests. |
274 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { | 277 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { |
275 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; | 278 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; |
276 | 279 |
277 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( | 280 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( |
278 "GET", GURL(payload.url))); | 281 "GET", GURL(payload.url))); |
279 | 282 |
280 MessageLoop::current()->Run(); | 283 MessageLoop::current()->Run(); |
281 } | 284 } |
282 | 285 |
OLD | NEW |