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