| 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 "platform/testing/HistogramTester.h" | 5 #include "platform/testing/HistogramTester.h" |
| 6 #include "platform/testing/UnitTestHelpers.h" | 6 #include "platform/testing/UnitTestHelpers.h" |
| 7 #include "web/WebViewImpl.h" | 7 #include "web/WebViewImpl.h" |
| 8 #include "web/tests/sim/SimCompositor.h" | 8 #include "web/tests/sim/SimCompositor.h" |
| 9 #include "web/tests/sim/SimDisplayItemList.h" | 9 #include "web/tests/sim/SimDisplayItemList.h" |
| 10 #include "web/tests/sim/SimRequest.h" | 10 #include "web/tests/sim/SimRequest.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 void compositeFrame() { | 21 void compositeFrame() { |
| 22 compositor().beginFrame(); | 22 compositor().beginFrame(); |
| 23 testing::runPendingTasks(); | 23 testing::runPendingTasks(); |
| 24 if (compositor().needsBeginFrame()) | 24 if (compositor().needsBeginFrame()) |
| 25 compositor().beginFrame(); // VisibleNestedInRight doesn't need this. | 25 compositor().beginFrame(); // VisibleNestedInRight doesn't need this. |
| 26 ASSERT_FALSE(compositor().needsBeginFrame()); | 26 ASSERT_FALSE(compositor().needsBeginFrame()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 std::unique_ptr<SimRequest> createMainResource() { | 29 std::unique_ptr<SimRequest> createMainResource() { |
| 30 std::unique_ptr<SimRequest> mainResource = | 30 std::unique_ptr<SimRequest> mainResource = |
| 31 wrapUnique(new SimRequest("https://example.com/", "text/html")); | 31 WTF::wrapUnique(new SimRequest("https://example.com/", "text/html")); |
| 32 loadURL("https://example.com/"); | 32 loadURL("https://example.com/"); |
| 33 return mainResource; | 33 return mainResource; |
| 34 } | 34 } |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 TEST_F(DeferredLoadingTest, Visible) { | 37 TEST_F(DeferredLoadingTest, Visible) { |
| 38 HistogramTester histogramTester; | 38 HistogramTester histogramTester; |
| 39 std::unique_ptr<SimRequest> mainResource = createMainResource(); | 39 std::unique_ptr<SimRequest> mainResource = createMainResource(); |
| 40 | 40 |
| 41 mainResource->complete("<iframe sandbox></iframe>"); | 41 mainResource->complete("<iframe sandbox></iframe>"); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 SimRequest frameResource("https://example.com/iframe.html", "text/html"); | 177 SimRequest frameResource("https://example.com/iframe.html", "text/html"); |
| 178 | 178 |
| 179 mainResource->complete("<iframe src='iframe.html'></iframe>"); | 179 mainResource->complete("<iframe src='iframe.html'></iframe>"); |
| 180 frameResource.complete("<iframe></iframe>"); | 180 frameResource.complete("<iframe></iframe>"); |
| 181 compositeFrame(); | 181 compositeFrame(); |
| 182 | 182 |
| 183 histogramTester.expectTotalCount(kHistogramName, 0); | 183 histogramTester.expectTotalCount(kHistogramName, 0); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |