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/common/user_agent.h" | 6 #include "content/public/common/user_agent.h" |
7 #include "content/public/test/render_view_test.h" | 7 #include "content/public/test/render_view_test.h" |
8 #include "content/renderer/pepper/url_request_info_util.h" | 8 #include "content/renderer/pepper/url_request_info_util.h" |
9 #include "ppapi/proxy/connection.h" | 9 #include "ppapi/proxy/connection.h" |
10 #include "ppapi/proxy/url_request_info_resource.h" | 10 #include "ppapi/proxy/url_request_info_resource.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 using ppapi::URLRequestInfoData; | 50 using ppapi::URLRequestInfoData; |
51 | 51 |
52 namespace content { | 52 namespace content { |
53 | 53 |
54 class URLRequestInfoTest : public RenderViewTest { | 54 class URLRequestInfoTest : public RenderViewTest { |
55 public: | 55 public: |
56 // Note: using -1 as the instance value allows code in | 56 // Note: using -1 as the instance value allows code in |
57 // url_request_info_util.cc to detect that this is a test instance. | 57 // url_request_info_util.cc to detect that this is a test instance. |
58 URLRequestInfoTest() : pp_instance_(-1) {} | 58 URLRequestInfoTest() : pp_instance_(-1) {} |
59 | 59 |
60 virtual void SetUp() OVERRIDE { | 60 virtual void SetUp() override { |
61 RenderViewTest::SetUp(); | 61 RenderViewTest::SetUp(); |
62 ppapi::ProxyLock::DisableLockingOnThreadForTest(); | 62 ppapi::ProxyLock::DisableLockingOnThreadForTest(); |
63 | 63 |
64 test_globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); | 64 test_globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); |
65 | 65 |
66 // This resource doesn't do IPC, so a null connection is fine. | 66 // This resource doesn't do IPC, so a null connection is fine. |
67 info_ = new URLRequestInfoResource( | 67 info_ = new URLRequestInfoResource( |
68 ppapi::proxy::Connection(), pp_instance_, URLRequestInfoData()); | 68 ppapi::proxy::Connection(), pp_instance_, URLRequestInfoData()); |
69 } | 69 } |
70 | 70 |
71 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() override { |
72 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); | 72 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); |
73 RenderViewTest::TearDown(); | 73 RenderViewTest::TearDown(); |
74 } | 74 } |
75 | 75 |
76 bool GetDownloadToFile() { | 76 bool GetDownloadToFile() { |
77 WebURLRequest web_request; | 77 WebURLRequest web_request; |
78 URLRequestInfoData data = info_->GetData(); | 78 URLRequestInfoData data = info_->GetData(); |
79 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request)) | 79 if (!CreateWebURLRequest(pp_instance_, &data, GetMainFrame(), &web_request)) |
80 return false; | 80 return false; |
81 return web_request.downloadToFile(); | 81 return web_request.downloadToFile(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // Test that we can set multiple header fields using \n delimiter. | 233 // Test that we can set multiple header fields using \n delimiter. |
234 EXPECT_TRUE( | 234 EXPECT_TRUE( |
235 SetStringProperty(PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz")); | 235 SetStringProperty(PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz")); |
236 EXPECT_TRUE(IsExpected(GetHeaderValue("foo"), "bar")); | 236 EXPECT_TRUE(IsExpected(GetHeaderValue("foo"), "bar")); |
237 EXPECT_TRUE(IsExpected(GetHeaderValue("bar"), "baz")); | 237 EXPECT_TRUE(IsExpected(GetHeaderValue("bar"), "baz")); |
238 } | 238 } |
239 | 239 |
240 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody. | 240 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody. |
241 | 241 |
242 } // namespace content | 242 } // namespace content |
OLD | NEW |