| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/loader/DocumentLoadTiming.h" | 5 #include "core/loader/DocumentLoadTiming.h" |
| 6 | 6 |
| 7 #include "core/loader/DocumentLoader.h" | 7 #include "core/loader/DocumentLoader.h" |
| 8 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class DocumentLoadTimingTest : public testing::Test {}; | 14 class DocumentLoadTimingTest : public ::testing::Test {}; |
| 15 | 15 |
| 16 TEST_F(DocumentLoadTimingTest, ensureValidNavigationStartAfterEmbedder) { | 16 TEST_F(DocumentLoadTimingTest, ensureValidNavigationStartAfterEmbedder) { |
| 17 std::unique_ptr<DummyPageHolder> dummy_page = DummyPageHolder::Create(); | 17 std::unique_ptr<DummyPageHolder> dummy_page = DummyPageHolder::Create(); |
| 18 DocumentLoadTiming timing(*(dummy_page->GetDocument().Loader())); | 18 DocumentLoadTiming timing(*(dummy_page->GetDocument().Loader())); |
| 19 | 19 |
| 20 double delta = -1000; | 20 double delta = -1000; |
| 21 double embedder_navigation_start = MonotonicallyIncreasingTime() + delta; | 21 double embedder_navigation_start = MonotonicallyIncreasingTime() + delta; |
| 22 timing.SetNavigationStart(embedder_navigation_start); | 22 timing.SetNavigationStart(embedder_navigation_start); |
| 23 | 23 |
| 24 double real_wall_time = CurrentTime(); | 24 double real_wall_time = CurrentTime(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 48 | 48 |
| 49 EXPECT_NEAR(adjusted_load_event_end, real_wall_load_event_end, .001); | 49 EXPECT_NEAR(adjusted_load_event_end, real_wall_load_event_end, .001); |
| 50 | 50 |
| 51 double adjusted_navigation_start = | 51 double adjusted_navigation_start = |
| 52 timing.MonotonicTimeToPseudoWallTime(timing.NavigationStart()); | 52 timing.MonotonicTimeToPseudoWallTime(timing.NavigationStart()); |
| 53 EXPECT_NEAR(adjusted_load_event_end - adjusted_navigation_start, | 53 EXPECT_NEAR(adjusted_load_event_end - adjusted_navigation_start, |
| 54 -navigation_start_delta, .001); | 54 -navigation_start_delta, .001); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace blink | 57 } // namespace blink |
| OLD | NEW |