Index: Source/web/tests/WebDocumentTest.cpp |
diff --git a/Source/web/tests/WebDocumentTest.cpp b/Source/web/tests/WebDocumentTest.cpp |
index 7588424727cab1c7afb5b1a96cceb8c02ee76164..923e23d444c9dc8bde4f56677d82097e6c4ac023 100644 |
--- a/Source/web/tests/WebDocumentTest.cpp |
+++ b/Source/web/tests/WebDocumentTest.cpp |
@@ -15,14 +15,17 @@ |
#include "core/rendering/style/RenderStyle.h" |
#include "platform/graphics/Color.h" |
#include "web/tests/FrameTestHelpers.h" |
+#include "web/tests/URLTestHelpers.h" |
#include <gtest/gtest.h> |
+using namespace blink; |
abarth-chromium
2014/08/01 22:27:32
You shouldn't need this.
oystein (OOO til 10th of July)
2014/08/01 22:57:06
Looks like it's necessary in the web/tests/* files
|
using blink::Color; |
using blink::Document; |
using blink::HTMLElement; |
using blink::RenderStyle; |
using blink::FrameTestHelpers::WebViewHelper; |
+using blink::URLTestHelpers::toKURL; |
using blink::WebDocument; |
namespace { |
@@ -60,4 +63,47 @@ TEST(WebDocumentTest, InsertStyleSheet) |
ASSERT_EQ(Color(0, 128, 0), style->visitedDependentColor(blink::CSSPropertyColor)); |
} |
+TEST(WebDocumentTest, BeginExitTransition) |
+{ |
+ std::string baseURL = "http://www.test.com:0/"; |
+ const char* htmlURL = "transition_exit.html"; |
+ const char* cssURL = "transition_exit.css"; |
+ URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + htmlURL), WebString::fromUTF8(htmlURL)); |
+ URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + cssURL), WebString::fromUTF8(cssURL)); |
+ |
+ WebViewHelper webViewHelper; |
+ webViewHelper.initializeAndLoad(baseURL + htmlURL); |
+ |
+ WebFrame* frame = webViewHelper.webView()->mainFrame(); |
+ Document* coreDoc = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); |
+ Element* transitionElement = coreDoc->getElementById("foo"); |
+ ASSERT(transitionElement); |
+ |
+ RenderStyle* transitionStyle = transitionElement->renderStyle(); |
+ ASSERT(transitionStyle); |
+ |
+ HTMLElement* bodyElement = coreDoc->body(); |
+ ASSERT(bodyElement); |
+ |
+ RenderStyle* bodyStyle = bodyElement->renderStyle(); |
+ ASSERT(bodyStyle); |
+ // The transition_exit.css stylesheet should not have been applied at this point. |
+ ASSERT_EQ(Color(0, 0, 0), bodyStyle->visitedDependentColor(blink::CSSPropertyColor)); |
+ |
+ frame->document().beginExitTransition("#foo"); |
+ |
+ // Make sure the stylesheet load request gets processed. |
+ FrameTestHelpers::pumpPendingRequestsDoNotUse(frame); |
+ coreDoc->updateRenderTreeIfNeeded(); |
+ |
+ // The element should now be hidden. |
+ transitionStyle = transitionElement->renderStyle(); |
+ ASSERT_FALSE(transitionStyle); |
+ |
+ // The stylesheet should now have been applied. |
+ bodyStyle = bodyElement->renderStyle(); |
+ ASSERT(bodyStyle); |
+ ASSERT_EQ(Color(0, 128, 0), bodyStyle->visitedDependentColor(blink::CSSPropertyColor)); |
+} |
+ |
} |