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

Side by Side Diff: content/child/web_url_loader_impl_unittest.cc

Issue 2557673006: Move Origin::GetURL() out of resource request critical path (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 20 matching lines...) Expand all
31 #include "net/http/http_response_headers.h" 31 #include "net/http/http_response_headers.h"
32 #include "net/http/http_util.h" 32 #include "net/http/http_util.h"
33 #include "net/url_request/redirect_info.h" 33 #include "net/url_request/redirect_info.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 #include "third_party/WebKit/public/platform/WebString.h" 35 #include "third_party/WebKit/public/platform/WebString.h"
36 #include "third_party/WebKit/public/platform/WebURLError.h" 36 #include "third_party/WebKit/public/platform/WebURLError.h"
37 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 37 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
38 #include "third_party/WebKit/public/platform/WebURLRequest.h" 38 #include "third_party/WebKit/public/platform/WebURLRequest.h"
39 #include "third_party/WebKit/public/platform/WebURLResponse.h" 39 #include "third_party/WebKit/public/platform/WebURLResponse.h"
40 #include "url/gurl.h" 40 #include "url/gurl.h"
41 #include "url/origin.h"
41 42
42 namespace content { 43 namespace content {
43 namespace { 44 namespace {
44 45
45 const char kTestURL[] = "http://foo"; 46 const char kTestURL[] = "http://foo";
46 const char kTestHTTPSURL[] = "https://foo"; 47 const char kTestHTTPSURL[] = "https://foo";
47 const char kTestData[] = "blah!"; 48 const char kTestData[] = "blah!";
48 49
49 const char kFtpDirMimeType[] = "text/vnd.chromium.ftp-dir"; 50 const char kFtpDirMimeType[] = "text/vnd.chromium.ftp-dir";
50 // Simple FTP directory listing. Tests are not concerned with correct parsing, 51 // Simple FTP directory listing. Tests are not concerned with correct parsing,
(...skipping 20 matching lines...) Expand all
71 SyncLoadResponse* response, 72 SyncLoadResponse* response,
72 blink::WebURLRequest::LoadingIPCType ipc_type, 73 blink::WebURLRequest::LoadingIPCType ipc_type,
73 mojom::URLLoaderFactory* url_loader_factory) override { 74 mojom::URLLoaderFactory* url_loader_factory) override {
74 *response = sync_load_response_; 75 *response = sync_load_response_;
75 } 76 }
76 77
77 int StartAsync( 78 int StartAsync(
78 std::unique_ptr<ResourceRequest> request, 79 std::unique_ptr<ResourceRequest> request,
79 int routing_id, 80 int routing_id,
80 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, 81 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
81 const GURL& frame_origin, 82 const url::Origin& frame_origin,
82 std::unique_ptr<RequestPeer> peer, 83 std::unique_ptr<RequestPeer> peer,
83 blink::WebURLRequest::LoadingIPCType ipc_type, 84 blink::WebURLRequest::LoadingIPCType ipc_type,
84 mojom::URLLoaderFactory* url_loader_factory, 85 mojom::URLLoaderFactory* url_loader_factory,
85 mojo::AssociatedGroup* associated_group) override { 86 mojo::AssociatedGroup* associated_group) override {
86 EXPECT_FALSE(peer_); 87 EXPECT_FALSE(peer_);
87 EXPECT_EQ(blink::WebURLRequest::LoadingIPCType::ChromeIPC, ipc_type); 88 EXPECT_EQ(blink::WebURLRequest::LoadingIPCType::ChromeIPC, ipc_type);
88 peer_ = std::move(peer); 89 peer_ = std::move(peer);
89 url_ = request->url; 90 url_ = request->url;
90 stream_url_ = request->resource_body_stream_url; 91 stream_url_ = request->resource_body_stream_url;
91 return 1; 92 return 1;
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 int64_t encoded_body_length = 0; 688 int64_t encoded_body_length = 0;
688 client()->loader()->loadSynchronously( 689 client()->loader()->loadSynchronously(
689 request, response, error, data, encoded_data_length, encoded_body_length); 690 request, response, error, data, encoded_data_length, encoded_body_length);
690 691
691 EXPECT_EQ(kEncodedBodyLength, encoded_body_length); 692 EXPECT_EQ(kEncodedBodyLength, encoded_body_length);
692 EXPECT_EQ(kEncodedDataLength, encoded_data_length); 693 EXPECT_EQ(kEncodedDataLength, encoded_data_length);
693 } 694 }
694 695
695 } // namespace 696 } // namespace
696 } // namespace content 697 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698