| 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/ProgressTracker.h" | 5 #include "core/loader/ProgressTracker.h" |
| 6 | 6 |
| 7 #include "core/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
| 8 #include "core/loader/EmptyClients.h" | 8 #include "core/loader/EmptyClients.h" |
| 9 #include "core/testing/DummyPageHolder.h" | 9 #include "core/testing/DummyPageHolder.h" |
| 10 #include "platform/network/ResourceResponse.h" | 10 #include "platform/network/ResourceResponse.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 private: | 25 private: |
| 26 double m_lastProgress; | 26 double m_lastProgress; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 class ProgressTrackerTest : public ::testing::Test { | 29 class ProgressTrackerTest : public ::testing::Test { |
| 30 public: | 30 public: |
| 31 ProgressTrackerTest() | 31 ProgressTrackerTest() |
| 32 : m_response(KURL(ParsedURLString, "http://example.com"), | 32 : m_response(KURL(ParsedURLString, "http://example.com"), |
| 33 "text/html", | 33 "text/html", |
| 34 1024, | 34 1024, |
| 35 nullAtom, | 35 nullAtom) {} |
| 36 String()) {} | |
| 37 | 36 |
| 38 void SetUp() override { | 37 void SetUp() override { |
| 39 m_client = new ProgressClient; | 38 m_client = new ProgressClient; |
| 40 m_dummyPageHolder = | 39 m_dummyPageHolder = |
| 41 DummyPageHolder::create(IntSize(800, 600), nullptr, m_client.get()); | 40 DummyPageHolder::create(IntSize(800, 600), nullptr, m_client.get()); |
| 42 frame().settings()->setProgressBarCompletion( | 41 frame().settings()->setProgressBarCompletion( |
| 43 ProgressBarCompletion::ResourcesBeforeDCL); | 42 ProgressBarCompletion::ResourcesBeforeDCL); |
| 44 } | 43 } |
| 45 | 44 |
| 46 LocalFrame& frame() const { return m_dummyPageHolder->frame(); } | 45 LocalFrame& frame() const { return m_dummyPageHolder->frame(); } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // .2 for finishing parsing, .5 for all bytes received. | 116 // .2 for finishing parsing, .5 for all bytes received. |
| 118 // Medium priority resource is ignored. | 117 // Medium priority resource is ignored. |
| 119 progress().completeProgress(1ul); | 118 progress().completeProgress(1ul); |
| 120 EXPECT_EQ(0.7, lastProgress()); | 119 EXPECT_EQ(0.7, lastProgress()); |
| 121 | 120 |
| 122 progress().finishedParsing(); | 121 progress().finishedParsing(); |
| 123 EXPECT_EQ(1.0, lastProgress()); | 122 EXPECT_EQ(1.0, lastProgress()); |
| 124 } | 123 } |
| 125 | 124 |
| 126 } // namespace blink | 125 } // namespace blink |
| OLD | NEW |