| 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 <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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 private: | 393 private: |
| 394 ResourceResponseInfo response_info_; | 394 ResourceResponseInfo response_info_; |
| 395 }; | 395 }; |
| 396 | 396 |
| 397 // TODO(simonjam): Enable this when 10829031 lands. | 397 // TODO(simonjam): Enable this when 10829031 lands. |
| 398 TEST_F(TimeConversionTest, DISABLED_ProperlyInitialized) { | 398 TEST_F(TimeConversionTest, DISABLED_ProperlyInitialized) { |
| 399 ResourceResponseHead response_head; | 399 ResourceResponseHead response_head; |
| 400 response_head.error_code = net::OK; | 400 response_head.error_code = net::OK; |
| 401 response_head.request_start = base::TimeTicks::FromInternalValue(5); | 401 response_head.request_start = base::TimeTicks::FromInternalValue(5); |
| 402 response_head.response_start = base::TimeTicks::FromInternalValue(15); | 402 response_head.response_start = base::TimeTicks::FromInternalValue(15); |
| 403 response_head.load_timing.base_time = base::Time::Now(); | 403 response_head.load_timing.request_start_time = base::Time::Now(); |
| 404 response_head.load_timing.base_ticks = base::TimeTicks::FromInternalValue(10); | 404 response_head.load_timing.request_start = |
| 405 response_head.load_timing.dns_start = -1; | 405 base::TimeTicks::FromInternalValue(10); |
| 406 response_head.load_timing.connect_start = 3; | 406 response_head.load_timing.connect_timing.connect_start = |
| 407 base::TimeTicks::FromInternalValue(13); |
| 407 | 408 |
| 408 PerformTest(response_head); | 409 PerformTest(response_head); |
| 409 | 410 |
| 410 EXPECT_LT(0, response_info().load_timing.base_ticks.ToInternalValue()); | 411 EXPECT_LT(base::TimeTicks(), response_info().load_timing.request_start); |
| 411 EXPECT_EQ(-1, response_info().load_timing.dns_start); | 412 EXPECT_EQ(base::TimeTicks(), |
| 412 EXPECT_LE(0, response_info().load_timing.connect_start); | 413 response_info().load_timing.connect_timing.dns_start); |
| 414 EXPECT_LE(response_head.load_timing.request_start, |
| 415 response_info().load_timing.connect_timing.connect_start); |
| 413 } | 416 } |
| 414 | 417 |
| 415 TEST_F(TimeConversionTest, PartiallyInitialized) { | 418 TEST_F(TimeConversionTest, PartiallyInitialized) { |
| 416 ResourceResponseHead response_head; | 419 ResourceResponseHead response_head; |
| 417 response_head.error_code = net::OK; | 420 response_head.error_code = net::OK; |
| 418 response_head.request_start = base::TimeTicks::FromInternalValue(5); | 421 response_head.request_start = base::TimeTicks::FromInternalValue(5); |
| 419 response_head.response_start = base::TimeTicks::FromInternalValue(15); | 422 response_head.response_start = base::TimeTicks::FromInternalValue(15); |
| 420 | 423 |
| 421 PerformTest(response_head); | 424 PerformTest(response_head); |
| 422 | 425 |
| 423 EXPECT_EQ(0, response_info().load_timing.base_ticks.ToInternalValue()); | 426 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
| 424 EXPECT_EQ(-1, response_info().load_timing.dns_start); | 427 EXPECT_EQ(base::TimeTicks(), |
| 428 response_info().load_timing.connect_timing.dns_start); |
| 425 } | 429 } |
| 426 | 430 |
| 427 TEST_F(TimeConversionTest, NotInitialized) { | 431 TEST_F(TimeConversionTest, NotInitialized) { |
| 428 ResourceResponseHead response_head; | 432 ResourceResponseHead response_head; |
| 429 response_head.error_code = net::OK; | 433 response_head.error_code = net::OK; |
| 430 | 434 |
| 431 PerformTest(response_head); | 435 PerformTest(response_head); |
| 432 | 436 |
| 433 EXPECT_EQ(0, response_info().load_timing.base_ticks.ToInternalValue()); | 437 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
| 434 EXPECT_EQ(-1, response_info().load_timing.dns_start); | 438 EXPECT_EQ(base::TimeTicks(), |
| 439 response_info().load_timing.connect_timing.dns_start); |
| 435 } | 440 } |
| 436 | 441 |
| 437 } // namespace content | 442 } // namespace content |
| OLD | NEW |