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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleElementTest.cpp

Issue 2700123003: DO NOT COMMIT: Results of running old (current) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/dom/StyleElement.h" 5 #include "core/dom/StyleElement.h"
6 6
7 #include <memory>
7 #include "core/css/StyleSheetContents.h" 8 #include "core/css/StyleSheetContents.h"
8 #include "core/dom/Comment.h" 9 #include "core/dom/Comment.h"
9 #include "core/html/HTMLStyleElement.h" 10 #include "core/html/HTMLStyleElement.h"
10 #include "core/testing/DummyPageHolder.h" 11 #include "core/testing/DummyPageHolder.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include <memory>
13 13
14 namespace blink { 14 namespace blink {
15 15
16 TEST(StyleElementTest, CreateSheetUsesCache) { 16 TEST(StyleElementTest, CreateSheetUsesCache) {
17 std::unique_ptr<DummyPageHolder> dummyPageHolder = 17 std::unique_ptr<DummyPageHolder> dummyPageHolder =
18 DummyPageHolder::create(IntSize(800, 600)); 18 DummyPageHolder::create(IntSize(800, 600));
19 Document& document = dummyPageHolder->document(); 19 Document& document = dummyPageHolder->document();
20 20
21 document.documentElement()->setInnerHTML( 21 document.documentElement()->setInnerHTML(
22 "<style id=style>a { top: 0; }</style>"); 22 "<style id=style>a { top: 0; }</style>");
23 23
24 HTMLStyleElement& styleElement = 24 HTMLStyleElement& styleElement =
25 toHTMLStyleElement(*document.getElementById("style")); 25 toHTMLStyleElement(*document.getElementById("style"));
26 StyleSheetContents* sheet = styleElement.sheet()->contents(); 26 StyleSheetContents* sheet = styleElement.sheet()->contents();
27 27
28 Comment* comment = document.createComment("hello!"); 28 Comment* comment = document.createComment("hello!");
29 styleElement.appendChild(comment); 29 styleElement.appendChild(comment);
30 EXPECT_EQ(styleElement.sheet()->contents(), sheet); 30 EXPECT_EQ(styleElement.sheet()->contents(), sheet);
31 31
32 styleElement.removeChild(comment); 32 styleElement.removeChild(comment);
33 EXPECT_EQ(styleElement.sheet()->contents(), sheet); 33 EXPECT_EQ(styleElement.sheet()->contents(), sheet);
34 } 34 }
35 35
36 } // namespace blink 36 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698