| 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/exported/WebViewBase.h" | 5 #include "core/exported/WebViewBase.h" |
| 6 #include "platform/testing/HistogramTester.h" | 6 #include "platform/testing/HistogramTester.h" |
| 7 #include "platform/testing/UnitTestHelpers.h" | 7 #include "platform/testing/UnitTestHelpers.h" |
| 8 #include "web/WebLocalFrameImpl.h" | 8 #include "web/WebLocalFrameImpl.h" |
| 9 #include "web/tests/sim/SimCompositor.h" | 9 #include "web/tests/sim/SimCompositor.h" |
| 10 #include "web/tests/sim/SimDisplayItemList.h" | 10 #include "web/tests/sim/SimDisplayItemList.h" |
| 11 #include "web/tests/sim/SimRequest.h" | 11 #include "web/tests/sim/SimRequest.h" |
| 12 #include "web/tests/sim/SimTest.h" | 12 #include "web/tests/sim/SimTest.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 static const char kHistogramName[] = | 16 static const char kHistogramName[] = |
| 17 "Navigation.DeferredDocumentLoading.StatesV4"; | 17 "Navigation.DeferredDocumentLoading.StatesV4"; |
| 18 | 18 |
| 19 class DeferredLoadingTest : public SimTest { | 19 class DeferredLoadingTest : public SimTest { |
| 20 protected: | 20 protected: |
| 21 DeferredLoadingTest() { WebView().Resize(WebSize(640, 480)); } | 21 DeferredLoadingTest() {} |
| 22 |
| 23 void SetUp() override { |
| 24 SimTest::SetUp(); |
| 25 WebView().Resize(WebSize(640, 480)); |
| 26 } |
| 22 void CompositeFrame() { | 27 void CompositeFrame() { |
| 23 while (Compositor().NeedsBeginFrame()) { | 28 while (Compositor().NeedsBeginFrame()) { |
| 24 Compositor().BeginFrame(); | 29 Compositor().BeginFrame(); |
| 25 testing::RunPendingTasks(); | 30 testing::RunPendingTasks(); |
| 26 } | 31 } |
| 27 } | 32 } |
| 28 | 33 |
| 29 std::unique_ptr<SimRequest> CreateMainResource() { | 34 std::unique_ptr<SimRequest> CreateMainResource() { |
| 30 std::unique_ptr<SimRequest> main_resource = | 35 std::unique_ptr<SimRequest> main_resource = |
| 31 WTF::WrapUnique(new SimRequest("https://example.com/", "text/html")); | 36 WTF::WrapUnique(new SimRequest("https://example.com/", "text/html")); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 496 |
| 492 ExpectCount(WouldLoadReason::kCreated, 1); | 497 ExpectCount(WouldLoadReason::kCreated, 1); |
| 493 ExpectCount(WouldLoadReason::kVisible, 1); | 498 ExpectCount(WouldLoadReason::kVisible, 1); |
| 494 ExpectCount(WouldLoadReason::k1ScreenAway, 1); | 499 ExpectCount(WouldLoadReason::k1ScreenAway, 1); |
| 495 ExpectCount(WouldLoadReason::k2ScreensAway, 1); | 500 ExpectCount(WouldLoadReason::k2ScreensAway, 1); |
| 496 ExpectCount(WouldLoadReason::k3ScreensAway, 1); | 501 ExpectCount(WouldLoadReason::k3ScreensAway, 1); |
| 497 ExpectTotalCount(5); | 502 ExpectTotalCount(5); |
| 498 } | 503 } |
| 499 | 504 |
| 500 } // namespace blink | 505 } // namespace blink |
| OLD | NEW |