Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/common/chrome_plugin_unittest.cc

Issue 155897: Add support to URLRequest for deferring redirects.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698