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

Side by Side Diff: content/renderer/pepper/pepper_url_request_unittest.cc

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove code duplication Created 7 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 4
5 #include "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "content/public/test/render_view_test.h" 6 #include "content/public/test/render_view_test.h"
7 #include "content/renderer/pepper/url_request_info_util.h" 7 #include "content/renderer/pepper/url_request_info_util.h"
8 #include "ppapi/proxy/connection.h" 8 #include "ppapi/proxy/connection.h"
9 #include "ppapi/proxy/url_request_info_resource.h" 9 #include "ppapi/proxy/url_request_info_resource.h"
10 #include "ppapi/shared_impl/test_globals.h" 10 #include "ppapi/shared_impl/test_globals.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 virtual void TearDown() OVERRIDE { 72 virtual void TearDown() OVERRIDE {
73 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); 73 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_);
74 RenderViewTest::TearDown(); 74 RenderViewTest::TearDown();
75 } 75 }
76 76
77 bool GetDownloadToFile() { 77 bool GetDownloadToFile() {
78 WebURLRequest web_request; 78 WebURLRequest web_request;
79 URLRequestInfoData data = info_->GetData(); 79 URLRequestInfoData data = info_->GetData();
80 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) 80 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request))
81 return false; 81 return false;
82 return web_request.downloadToFile(); 82 return web_request.downloadToFile();
83 } 83 }
84 84
85 WebCString GetURL() { 85 WebCString GetURL() {
86 WebURLRequest web_request; 86 WebURLRequest web_request;
87 URLRequestInfoData data = info_->GetData(); 87 URLRequestInfoData data = info_->GetData();
88 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) 88 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request))
89 return WebCString(); 89 return WebCString();
90 return web_request.url().spec(); 90 return web_request.url().spec();
91 } 91 }
92 92
93 WebString GetMethod() { 93 WebString GetMethod() {
94 WebURLRequest web_request; 94 WebURLRequest web_request;
95 URLRequestInfoData data = info_->GetData(); 95 URLRequestInfoData data = info_->GetData();
96 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) 96 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request))
97 return WebString(); 97 return WebString();
98 return web_request.httpMethod(); 98 return web_request.httpMethod();
99 } 99 }
100 100
101 WebString GetHeaderValue(const char* field) { 101 WebString GetHeaderValue(const char* field) {
102 WebURLRequest web_request; 102 WebURLRequest web_request;
103 URLRequestInfoData data = info_->GetData(); 103 URLRequestInfoData data = info_->GetData();
104 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) 104 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request))
105 return WebString(); 105 return WebString();
106 return web_request.httpHeaderField(WebString::fromUTF8(field)); 106 return web_request.httpHeaderField(WebString::fromUTF8(field));
107 } 107 }
108 108
109 bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) { 109 bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) {
110 return info_->SetBooleanProperty(prop, b); 110 return info_->SetBooleanProperty(prop, b);
111 } 111 }
112 bool SetStringProperty(PP_URLRequestProperty prop, const std::string& s) { 112 bool SetStringProperty(PP_URLRequestProperty prop, const std::string& s) {
113 return info_->SetStringProperty(prop, s); 113 return info_->SetStringProperty(prop, s);
114 } 114 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz")); 246 PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz"));
247 EXPECT_TRUE(IsExpected( 247 EXPECT_TRUE(IsExpected(
248 GetHeaderValue("foo"), "bar")); 248 GetHeaderValue("foo"), "bar"));
249 EXPECT_TRUE(IsExpected( 249 EXPECT_TRUE(IsExpected(
250 GetHeaderValue("bar"), "baz")); 250 GetHeaderValue("bar"), "baz"));
251 } 251 }
252 252
253 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody. 253 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody.
254 254
255 } // namespace content 255 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698