Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp

Issue 2197953002: Remove unnecessary uses of HTMLDocument (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: simplify Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layout/LayoutTheme.h" 5 #include "core/layout/LayoutTheme.h"
6 6
7 #include "core/dom/Document.h"
7 #include "core/dom/NodeComputedStyle.h" 8 #include "core/dom/NodeComputedStyle.h"
8 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLDocument.h"
10 #include "core/html/HTMLElement.h" 10 #include "core/html/HTMLElement.h"
11 #include "core/page/FocusController.h" 11 #include "core/page/FocusController.h"
12 #include "core/page/Page.h" 12 #include "core/page/Page.h"
13 #include "core/style/ComputedStyle.h" 13 #include "core/style/ComputedStyle.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include "platform/graphics/Color.h" 15 #include "platform/graphics/Color.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include <memory> 17 #include <memory>
18 18
19 namespace blink { 19 namespace blink {
20 20
21 class LayoutThemeTest : public ::testing::Test { 21 class LayoutThemeTest : public ::testing::Test {
22 protected: 22 protected:
23 void SetUp() override; 23 void SetUp() override;
24 HTMLDocument& document() const { return *m_document; } 24 Document& document() const { return *m_document; }
25 void setHtmlInnerHTML(const char* htmlContent); 25 void setHtmlInnerHTML(const char* htmlContent);
26 26
27 private: 27 private:
28 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 28 std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
29 Persistent<HTMLDocument> m_document; 29 Persistent<Document> m_document;
30 }; 30 };
31 31
32 void LayoutThemeTest::SetUp() 32 void LayoutThemeTest::SetUp()
33 { 33 {
34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
35 m_document = toHTMLDocument(&m_dummyPageHolder->document()); 35 m_document = &m_dummyPageHolder->document();
36 ASSERT(m_document); 36 ASSERT(m_document);
37 } 37 }
38 38
39 void LayoutThemeTest::setHtmlInnerHTML(const char* htmlContent) 39 void LayoutThemeTest::setHtmlInnerHTML(const char* htmlContent)
40 { 40 {
41 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS SERT_NO_EXCEPTION); 41 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS SERT_NO_EXCEPTION);
42 document().view()->updateAllLifecyclePhases(); 42 document().view()->updateAllLifecyclePhases();
43 } 43 }
44 44
45 inline Color outlineColor(Element* element) 45 inline Color outlineColor(Element* element)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 for (const auto& testcase : tests) { 132 for (const auto& testcase : tests) {
133 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(testcase.newUi); 133 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(testcase.newUi);
134 EXPECT_EQ(testcase.expectedResult, 134 EXPECT_EQ(testcase.expectedResult,
135 LayoutTheme::theme().formatMediaControlsCurrentTime(testcase.time, t estcase.duration)); 135 LayoutTheme::theme().formatMediaControlsCurrentTime(testcase.time, t estcase.duration));
136 } 136 }
137 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(newUi); 137 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(newUi);
138 } 138 }
139 139
140 } // namespace blink 140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698