| OLD | NEW |
| 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/proxy_lock.h" | 10 #include "ppapi/shared_impl/proxy_lock.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void TearDown() OVERRIDE { | 74 virtual void TearDown() OVERRIDE { |
| 75 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); | 75 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); |
| 76 RenderViewTest::TearDown(); | 76 RenderViewTest::TearDown(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool GetDownloadToFile() { | 79 bool GetDownloadToFile() { |
| 80 WebURLRequest web_request; | 80 WebURLRequest web_request; |
| 81 URLRequestInfoData data = info_->GetData(); | 81 URLRequestInfoData data = info_->GetData(); |
| 82 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) | 82 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request)) |
| 83 return false; | 83 return false; |
| 84 return web_request.downloadToFile(); | 84 return web_request.downloadToFile(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 WebCString GetURL() { | 87 WebCString GetURL() { |
| 88 WebURLRequest web_request; | 88 WebURLRequest web_request; |
| 89 URLRequestInfoData data = info_->GetData(); | 89 URLRequestInfoData data = info_->GetData(); |
| 90 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) | 90 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request)) |
| 91 return WebCString(); | 91 return WebCString(); |
| 92 return web_request.url().spec(); | 92 return web_request.url().spec(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 WebString GetMethod() { | 95 WebString GetMethod() { |
| 96 WebURLRequest web_request; | 96 WebURLRequest web_request; |
| 97 URLRequestInfoData data = info_->GetData(); | 97 URLRequestInfoData data = info_->GetData(); |
| 98 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) | 98 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request)) |
| 99 return WebString(); | 99 return WebString(); |
| 100 return web_request.httpMethod(); | 100 return web_request.httpMethod(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 WebString GetHeaderValue(const char* field) { | 103 WebString GetHeaderValue(const char* field) { |
| 104 WebURLRequest web_request; | 104 WebURLRequest web_request; |
| 105 URLRequestInfoData data = info_->GetData(); | 105 URLRequestInfoData data = info_->GetData(); |
| 106 if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) | 106 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request)) |
| 107 return WebString(); | 107 return WebString(); |
| 108 return web_request.httpHeaderField(WebString::fromUTF8(field)); | 108 return web_request.httpHeaderField(WebString::fromUTF8(field)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) { | 111 bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) { |
| 112 return info_->SetBooleanProperty(prop, b); | 112 return info_->SetBooleanProperty(prop, b); |
| 113 } | 113 } |
| 114 bool SetStringProperty(PP_URLRequestProperty prop, const std::string& s) { | 114 bool SetStringProperty(PP_URLRequestProperty prop, const std::string& s) { |
| 115 return info_->SetStringProperty(prop, s); | 115 return info_->SetStringProperty(prop, s); |
| 116 } | 116 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz")); | 248 PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz")); |
| 249 EXPECT_TRUE(IsExpected( | 249 EXPECT_TRUE(IsExpected( |
| 250 GetHeaderValue("foo"), "bar")); | 250 GetHeaderValue("foo"), "bar")); |
| 251 EXPECT_TRUE(IsExpected( | 251 EXPECT_TRUE(IsExpected( |
| 252 GetHeaderValue("bar"), "baz")); | 252 GetHeaderValue("bar"), "baz")); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody. | 255 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody. |
| 256 | 256 |
| 257 } // namespace content | 257 } // namespace content |
| OLD | NEW |