OLD | NEW |
---|---|
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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "public/web/WebDocument.h" | 7 #include "public/web/WebDocument.h" |
8 | 8 |
9 #include "core/CSSPropertyNames.h" | 9 #include "core/CSSPropertyNames.h" |
10 #include "core/dom/NodeRenderStyle.h" | 10 #include "core/dom/NodeRenderStyle.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 transitionStyle = transitionElement->renderStyle(); | 94 transitionStyle = transitionElement->renderStyle(); |
95 ASSERT_TRUE(transitionStyle); | 95 ASSERT_TRUE(transitionStyle); |
96 ASSERT_EQ(transitionStyle->opacity(), 0); | 96 ASSERT_EQ(transitionStyle->opacity(), 0); |
97 | 97 |
98 // The stylesheet should now have been applied. | 98 // The stylesheet should now have been applied. |
99 bodyStyle = bodyElement->renderStyle(); | 99 bodyStyle = bodyElement->renderStyle(); |
100 ASSERT(bodyStyle); | 100 ASSERT(bodyStyle); |
101 ASSERT_EQ(Color(0, 128, 0), bodyStyle->visitedDependentColor(CSSPropertyColo r)); | 101 ASSERT_EQ(Color(0, 128, 0), bodyStyle->visitedDependentColor(CSSPropertyColo r)); |
102 } | 102 } |
103 | 103 |
104 | |
105 TEST(WebDocumentTest, HideAndShowTransitionElements) | |
106 { | |
107 std::string baseURL = "http://www.test.com:0/"; | |
108 const char* htmlURL = "transition_hide_and_show.html"; | |
109 URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + htmlURL), WebString:: fromUTF8(htmlURL)); | |
110 | |
111 WebViewHelper webViewHelper; | |
112 webViewHelper.initializeAndLoad(baseURL + htmlURL); | |
113 | |
114 WebFrame* frame = webViewHelper.webView()->mainFrame(); | |
115 Document* coreDoc = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFr ame())->document(); | |
116 Element* transitionElement = coreDoc->getElementById("foo"); | |
117 ASSERT(transitionElement); | |
118 | |
119 RenderStyle* transitionStyle = transitionElement->renderStyle(); | |
120 ASSERT(transitionStyle); | |
121 ASSERT_EQ(transitionStyle->opacity(), 1); | |
Nate Chapin
2014/11/13 21:29:55
ASSERT_EQ will abort the test if the check fails.
Zhen Wang
2014/11/13 21:47:47
I see. Changing to EXPECT_EQ now.
| |
122 | |
123 // Hide transition elements | |
124 frame->document().hideTransitionElements("#foo"); | |
125 FrameTestHelpers::pumpPendingRequestsDoNotUse(frame); | |
126 coreDoc->updateRenderTreeIfNeeded(); | |
127 transitionStyle = transitionElement->renderStyle(); | |
128 ASSERT_TRUE(transitionStyle); | |
129 ASSERT_EQ(transitionStyle->opacity(), 0); | |
130 | |
131 // Show transition elements | |
132 frame->document().showTransitionElements("#foo"); | |
133 FrameTestHelpers::pumpPendingRequestsDoNotUse(frame); | |
134 coreDoc->updateRenderTreeIfNeeded(); | |
135 transitionStyle = transitionElement->renderStyle(); | |
136 ASSERT_TRUE(transitionStyle); | |
137 ASSERT_EQ(transitionStyle->opacity(), 1); | |
104 } | 138 } |
139 | |
140 } | |
OLD | NEW |