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

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

Issue 2390543002: Reflow comments in core/dom/. (Closed)
Patch Set: Reformat comments in core/dom/. Created 4 years, 2 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 /* 1 /*
2 * Copyright (c) 2014, Google Inc. All rights reserved. 2 * Copyright (c) 2014, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void DocumentTest::SetUp() { 62 void DocumentTest::SetUp() {
63 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 63 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
64 } 64 }
65 65
66 void DocumentTest::setHtmlInnerHTML(const char* htmlContent) { 66 void DocumentTest::setHtmlInnerHTML(const char* htmlContent) {
67 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), 67 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent),
68 ASSERT_NO_EXCEPTION); 68 ASSERT_NO_EXCEPTION);
69 document().view()->updateAllLifecyclePhases(); 69 document().view()->updateAllLifecyclePhases();
70 } 70 }
71 71
72 // This tests that we properly resize and re-layout pages for printing in the pr esence of 72 // This tests that we properly resize and re-layout pages for printing in the
73 // media queries effecting elements in a subtree layout boundary 73 // presence of media queries effecting elements in a subtree layout boundary
74 TEST_F(DocumentTest, PrintRelayout) { 74 TEST_F(DocumentTest, PrintRelayout) {
75 setHtmlInnerHTML( 75 setHtmlInnerHTML(
76 "<style>" 76 "<style>"
77 " div {" 77 " div {"
78 " width: 100px;" 78 " width: 100px;"
79 " height: 100px;" 79 " height: 100px;"
80 " overflow: hidden;" 80 " overflow: hidden;"
81 " }" 81 " }"
82 " span {" 82 " span {"
83 " width: 50px;" 83 " width: 50px;"
84 " height: 50px;" 84 " height: 50px;"
85 " }" 85 " }"
86 " @media screen {" 86 " @media screen {"
87 " span {" 87 " span {"
88 " width: 20px;" 88 " width: 20px;"
89 " }" 89 " }"
90 " }" 90 " }"
91 "</style>" 91 "</style>"
92 "<p><div><span></span></div></p>"); 92 "<p><div><span></span></div></p>");
93 FloatSize pageSize(400, 400); 93 FloatSize pageSize(400, 400);
94 float maximumShrinkRatio = 1.6; 94 float maximumShrinkRatio = 1.6;
95 95
96 document().frame()->setPrinting(true, pageSize, pageSize, maximumShrinkRatio); 96 document().frame()->setPrinting(true, pageSize, pageSize, maximumShrinkRatio);
97 EXPECT_EQ(document().documentElement()->offsetWidth(), 400); 97 EXPECT_EQ(document().documentElement()->offsetWidth(), 400);
98 document().frame()->setPrinting(false, FloatSize(), FloatSize(), 0); 98 document().frame()->setPrinting(false, FloatSize(), FloatSize(), 0);
99 EXPECT_EQ(document().documentElement()->offsetWidth(), 800); 99 EXPECT_EQ(document().documentElement()->offsetWidth(), 800);
100 } 100 }
101 101
102 // This test checks that Documunt::linkManifest() returns a value conform to the specification. 102 // This test checks that Documunt::linkManifest() returns a value conform to the
103 // specification.
103 TEST_F(DocumentTest, LinkManifest) { 104 TEST_F(DocumentTest, LinkManifest) {
104 // Test the default result. 105 // Test the default result.
105 EXPECT_EQ(0, document().linkManifest()); 106 EXPECT_EQ(0, document().linkManifest());
106 107
107 // Check that we use the first manifest with <link rel=manifest> 108 // Check that we use the first manifest with <link rel=manifest>
108 HTMLLinkElement* link = HTMLLinkElement::create(document(), false); 109 HTMLLinkElement* link = HTMLLinkElement::create(document(), false);
109 link->setAttribute(blink::HTMLNames::relAttr, "manifest"); 110 link->setAttribute(blink::HTMLNames::relAttr, "manifest");
110 link->setAttribute(blink::HTMLNames::hrefAttr, "foo.json"); 111 link->setAttribute(blink::HTMLNames::hrefAttr, "foo.json");
111 document().head()->appendChild(link); 112 document().head()->appendChild(link);
112 EXPECT_EQ(link, document().linkManifest()); 113 EXPECT_EQ(link, document().linkManifest());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 false}, 199 false},
199 {"origin", ReferrerPolicyOrigin, false}, 200 {"origin", ReferrerPolicyOrigin, false},
200 {"origin-when-crossorigin", ReferrerPolicyOriginWhenCrossOrigin, true}, 201 {"origin-when-crossorigin", ReferrerPolicyOriginWhenCrossOrigin, true},
201 {"origin-when-cross-origin", ReferrerPolicyOriginWhenCrossOrigin, false}, 202 {"origin-when-cross-origin", ReferrerPolicyOriginWhenCrossOrigin, false},
202 {"unsafe-url", ReferrerPolicyAlways}, 203 {"unsafe-url", ReferrerPolicyAlways},
203 }; 204 };
204 205
205 for (auto test : tests) { 206 for (auto test : tests) {
206 document().setReferrerPolicy(ReferrerPolicyDefault); 207 document().setReferrerPolicy(ReferrerPolicyDefault);
207 if (test.isLegacy) { 208 if (test.isLegacy) {
208 // Legacy keyword support must be explicitly enabled for the policy to par se successfully. 209 // Legacy keyword support must be explicitly enabled for the policy to
210 // parse successfully.
209 document().parseAndSetReferrerPolicy(test.policy); 211 document().parseAndSetReferrerPolicy(test.policy);
210 EXPECT_EQ(ReferrerPolicyDefault, document().getReferrerPolicy()); 212 EXPECT_EQ(ReferrerPolicyDefault, document().getReferrerPolicy());
211 document().parseAndSetReferrerPolicy(test.policy, true); 213 document().parseAndSetReferrerPolicy(test.policy, true);
212 } else { 214 } else {
213 document().parseAndSetReferrerPolicy(test.policy); 215 document().parseAndSetReferrerPolicy(test.policy);
214 } 216 }
215 EXPECT_EQ(test.expected, document().getReferrerPolicy()) << test.policy; 217 EXPECT_EQ(test.expected, document().getReferrerPolicy()) << test.policy;
216 } 218 }
217 } 219 }
218 220
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); 291 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy());
290 292
291 origin = SecurityOrigin::createFromString("https://example.test"); 293 origin = SecurityOrigin::createFromString("https://example.test");
292 document().setSecurityOrigin(origin); 294 document().setSecurityOrigin(origin);
293 document().enforceSandboxFlags(mask); 295 document().enforceSandboxFlags(mask);
294 EXPECT_TRUE(document().getSecurityOrigin()->isUnique()); 296 EXPECT_TRUE(document().getSecurityOrigin()->isUnique());
295 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); 297 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy());
296 } 298 }
297 299
298 } // namespace blink 300 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DocumentStyleSheetCollector.cpp ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698