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

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

Issue 138513002: Plumb network stack information about existence of cached copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 int data_length, 64 int data_length,
65 int encoded_data_length) OVERRIDE { 65 int encoded_data_length) OVERRIDE {
66 EXPECT_FALSE(complete_); 66 EXPECT_FALSE(complete_);
67 data_.append(data, data_length); 67 data_.append(data, data_length);
68 total_encoded_data_length_ += encoded_data_length; 68 total_encoded_data_length_ += encoded_data_length;
69 } 69 }
70 70
71 virtual void OnCompletedRequest( 71 virtual void OnCompletedRequest(
72 int error_code, 72 int error_code,
73 bool was_ignored_by_handler, 73 bool was_ignored_by_handler,
74 bool stale_copy_in_cache,
74 const std::string& security_info, 75 const std::string& security_info,
75 const base::TimeTicks& completion_time) OVERRIDE { 76 const base::TimeTicks& completion_time) OVERRIDE {
76 EXPECT_FALSE(complete_); 77 EXPECT_FALSE(complete_);
77 complete_ = true; 78 complete_ = true;
78 } 79 }
79 80
80 bool complete() const { 81 bool complete() const {
81 return complete_; 82 return complete_;
82 } 83 }
83 const std::string& data() const { 84 const std::string& data() const {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 virtual void OnReceivedData(const char* data, 290 virtual void OnReceivedData(const char* data,
290 int data_length, 291 int data_length,
291 int encoded_data_length) OVERRIDE { 292 int encoded_data_length) OVERRIDE {
292 EXPECT_EQ(defer_loading_, false); 293 EXPECT_EQ(defer_loading_, false);
293 set_defer_loading(false); 294 set_defer_loading(false);
294 } 295 }
295 296
296 virtual void OnCompletedRequest( 297 virtual void OnCompletedRequest(
297 int error_code, 298 int error_code,
298 bool was_ignored_by_handler, 299 bool was_ignored_by_handler,
300 bool stale_copy_in_cache,
299 const std::string& security_info, 301 const std::string& security_info,
300 const base::TimeTicks& completion_time) OVERRIDE { 302 const base::TimeTicks& completion_time) OVERRIDE {
301 } 303 }
302 304
303 protected: 305 protected:
304 virtual void SetUp() OVERRIDE { 306 virtual void SetUp() OVERRIDE {
305 ResourceDispatcherTest::SetUp(); 307 ResourceDispatcherTest::SetUp();
306 shared_handle_.Delete(kShmemSegmentName); 308 shared_handle_.Delete(kShmemSegmentName);
307 EXPECT_TRUE(shared_handle_.CreateNamed(kShmemSegmentName, false, 100)); 309 EXPECT_TRUE(shared_handle_.CreateNamed(kShmemSegmentName, false, 100));
308 } 310 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 378 }
377 379
378 virtual void OnReceivedData(const char* data, 380 virtual void OnReceivedData(const char* data,
379 int data_length, 381 int data_length,
380 int encoded_data_length) OVERRIDE { 382 int encoded_data_length) OVERRIDE {
381 } 383 }
382 384
383 virtual void OnCompletedRequest( 385 virtual void OnCompletedRequest(
384 int error_code, 386 int error_code,
385 bool was_ignored_by_handler, 387 bool was_ignored_by_handler,
388 bool stale_copy_in_cache,
386 const std::string& security_info, 389 const std::string& security_info,
387 const base::TimeTicks& completion_time) OVERRIDE { 390 const base::TimeTicks& completion_time) OVERRIDE {
388 } 391 }
389 392
390 const ResourceResponseInfo& response_info() const { return response_info_; } 393 const ResourceResponseInfo& response_info() const { return response_info_; }
391 394
392 private: 395 private:
393 ResourceResponseInfo response_info_; 396 ResourceResponseInfo response_info_;
394 }; 397 };
395 398
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 response_head.error_code = net::OK; 435 response_head.error_code = net::OK;
433 436
434 PerformTest(response_head); 437 PerformTest(response_head);
435 438
436 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); 439 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start);
437 EXPECT_EQ(base::TimeTicks(), 440 EXPECT_EQ(base::TimeTicks(),
438 response_info().load_timing.connect_timing.dns_start); 441 response_info().load_timing.connect_timing.dns_start);
439 } 442 }
440 443
441 } // namespace content 444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698