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

Side by Side Diff: chrome/renderer/extensions/extension_localization_peer_unittest.cc

Issue 2105713002: Render process changes for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_browser_process
Patch Set: Initialise encoded_body_length for sync XHR to data: URLs Created 4 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/extensions/extension_localization_peer.h" 5 #include "chrome/renderer/extensions/extension_localization_peer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 MOCK_METHOD2(OnUploadProgress, void(uint64_t position, uint64_t size)); 66 MOCK_METHOD2(OnUploadProgress, void(uint64_t position, uint64_t size));
67 MOCK_METHOD2(OnReceivedRedirect, 67 MOCK_METHOD2(OnReceivedRedirect,
68 bool(const net::RedirectInfo& redirect_info, 68 bool(const net::RedirectInfo& redirect_info,
69 const content::ResourceResponseInfo& info)); 69 const content::ResourceResponseInfo& info));
70 MOCK_METHOD1(OnReceivedResponse, 70 MOCK_METHOD1(OnReceivedResponse,
71 void(const content::ResourceResponseInfo& info)); 71 void(const content::ResourceResponseInfo& info));
72 MOCK_METHOD2(OnDownloadedData, void(int len, int encoded_data_length)); 72 MOCK_METHOD2(OnDownloadedData, void(int len, int encoded_data_length));
73 void OnReceivedData( 73 void OnReceivedData(
74 std::unique_ptr<RequestPeer::ReceivedData> data) override { 74 std::unique_ptr<RequestPeer::ReceivedData> data) override {
75 OnReceivedDataInternal(data->payload(), data->length(), 75 OnReceivedDataInternal(data->payload(), data->length(),
76 data->encoded_length()); 76 data->encoded_data_length());
77 } 77 }
78 MOCK_METHOD3(OnReceivedDataInternal, 78 MOCK_METHOD3(OnReceivedDataInternal,
79 void(const char* data, 79 void(const char* data,
80 int data_length, 80 int data_length,
81 int encoded_data_length)); 81 int encoded_data_length));
82 MOCK_METHOD6(OnCompletedRequest, void( 82 MOCK_METHOD6(OnCompletedRequest, void(
83 int error_code, 83 int error_code,
84 bool was_ignored_by_handler, 84 bool was_ignored_by_handler,
85 bool stale_copy_in_cache, 85 bool stale_copy_in_cache,
86 const std::string& security_info, 86 const std::string& security_info,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); 132 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1));
133 EXPECT_TRUE(NULL != filter_peer_.get()); 133 EXPECT_TRUE(NULL != filter_peer_.get());
134 } 134 }
135 135
136 TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) { 136 TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) {
137 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); 137 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1));
138 EXPECT_TRUE(GetData().empty()); 138 EXPECT_TRUE(GetData().empty());
139 139
140 const std::string data_chunk("12345"); 140 const std::string data_chunk("12345");
141 filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( 141 filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData(
142 data_chunk.data(), data_chunk.length(), -1))); 142 data_chunk.data(), data_chunk.length(), -1, 0)));
143 143
144 EXPECT_EQ(data_chunk, GetData()); 144 EXPECT_EQ(data_chunk, GetData());
145 145
146 filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( 146 filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData(
147 data_chunk.data(), data_chunk.length(), -1))); 147 data_chunk.data(), data_chunk.length(), -1, 0)));
148 EXPECT_EQ(data_chunk + data_chunk, GetData()); 148 EXPECT_EQ(data_chunk + data_chunk, GetData());
149 } 149 }
150 150
151 MATCHER_P(IsURLRequestEqual, status, "") { return arg.status() == status; } 151 MATCHER_P(IsURLRequestEqual, status, "") { return arg.status() == status; }
152 152
153 TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestBadURLRequestStatus) { 153 TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestBadURLRequestStatus) {
154 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); 154 SetUpExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1));
155 155
156 EXPECT_CALL(*original_peer_, OnReceivedResponse(_)); 156 EXPECT_CALL(*original_peer_, OnReceivedResponse(_));
157 EXPECT_CALL(*original_peer_, 157 EXPECT_CALL(*original_peer_,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 EXPECT_CALL(*original_peer_, OnReceivedResponse(_)); 256 EXPECT_CALL(*original_peer_, OnReceivedResponse(_));
257 EXPECT_CALL(*original_peer_, OnReceivedDataInternal(StrEq(message.c_str()), 257 EXPECT_CALL(*original_peer_, OnReceivedDataInternal(StrEq(message.c_str()),
258 message.length(), -1)); 258 message.length(), -1));
259 259
260 EXPECT_CALL(*original_peer_, OnCompletedRequest(net::OK, false, false, "", 260 EXPECT_CALL(*original_peer_, OnCompletedRequest(net::OK, false, false, "",
261 base::TimeTicks(), -1)); 261 base::TimeTicks(), -1));
262 262
263 filter_peer_->OnCompletedRequest(net::OK, false, false, std::string(), 263 filter_peer_->OnCompletedRequest(net::OK, false, false, std::string(),
264 base::TimeTicks(), -1); 264 base::TimeTicks(), -1);
265 } 265 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_localization_peer.cc ('k') | chrome/renderer/security_filter_peer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698