| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Loads/unloads the chrome test plugin. | 35 // Loads/unloads the chrome test plugin. |
| 36 void LoadPlugin(); | 36 void LoadPlugin(); |
| 37 void UnloadPlugin(); | 37 void UnloadPlugin(); |
| 38 | 38 |
| 39 // Runs the test and expects the given payload as a response. If expectation | 39 // Runs the test and expects the given payload as a response. If expectation |
| 40 // is NULL, the request is expected to fail. | 40 // is NULL, the request is expected to fail. |
| 41 void RunTest(const GURL& url, const TestResponsePayload* expected_payload); | 41 void RunTest(const GURL& url, const TestResponsePayload* expected_payload); |
| 42 | 42 |
| 43 // URLRequest::Delegate implementations | 43 // URLRequest::Delegate implementations |
| 44 virtual void OnReceivedRedirect(URLRequest* request, | |
| 45 const GURL& new_url) { } | |
| 46 virtual void OnResponseStarted(URLRequest* request); | 44 virtual void OnResponseStarted(URLRequest* request); |
| 47 virtual void OnReadCompleted(URLRequest* request, int bytes_read); | 45 virtual void OnReadCompleted(URLRequest* request, int bytes_read); |
| 48 | 46 |
| 49 // Helper called when the URLRequest is done. | 47 // Helper called when the URLRequest is done. |
| 50 void OnURLRequestComplete(); | 48 void OnURLRequestComplete(); |
| 51 | 49 |
| 52 // testing::Test | 50 // testing::Test |
| 53 virtual void SetUp() { | 51 virtual void SetUp() { |
| 54 LoadPlugin(); | 52 LoadPlugin(); |
| 55 URLRequest::RegisterProtocolFactory("test", &URLRequestTestJob::Factory); | 53 URLRequest::RegisterProtocolFactory("test", &URLRequestTestJob::Factory); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 276 |
| 279 // Tests that the plugin does not intercept its own requests. | 277 // Tests that the plugin does not intercept its own requests. |
| 280 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { | 278 TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { |
| 281 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; | 279 const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; |
| 282 | 280 |
| 283 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( | 281 EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( |
| 284 "GET", GURL(payload.url))); | 282 "GET", GURL(payload.url))); |
| 285 | 283 |
| 286 MessageLoop::current()->Run(); | 284 MessageLoop::current()->Run(); |
| 287 } | 285 } |
| OLD | NEW |