OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "public/platform/WebUnitTestSupport.h" | 71 #include "public/platform/WebUnitTestSupport.h" |
72 #include "public/web/WebAutofillClient.h" | 72 #include "public/web/WebAutofillClient.h" |
73 #include "public/web/WebContentDetectionResult.h" | 73 #include "public/web/WebContentDetectionResult.h" |
74 #include "public/web/WebDateTimeChooserCompletion.h" | 74 #include "public/web/WebDateTimeChooserCompletion.h" |
75 #include "public/web/WebDeviceEmulationParams.h" | 75 #include "public/web/WebDeviceEmulationParams.h" |
76 #include "public/web/WebDocument.h" | 76 #include "public/web/WebDocument.h" |
77 #include "public/web/WebDragOperation.h" | 77 #include "public/web/WebDragOperation.h" |
78 #include "public/web/WebElement.h" | 78 #include "public/web/WebElement.h" |
79 #include "public/web/WebFrame.h" | 79 #include "public/web/WebFrame.h" |
80 #include "public/web/WebFrameClient.h" | 80 #include "public/web/WebFrameClient.h" |
| 81 #include "public/web/WebFrameContentDumper.h" |
81 #include "public/web/WebHitTestResult.h" | 82 #include "public/web/WebHitTestResult.h" |
82 #include "public/web/WebInputEvent.h" | 83 #include "public/web/WebInputEvent.h" |
83 #include "public/web/WebScriptSource.h" | 84 #include "public/web/WebScriptSource.h" |
84 #include "public/web/WebSettings.h" | 85 #include "public/web/WebSettings.h" |
85 #include "public/web/WebTreeScopeType.h" | 86 #include "public/web/WebTreeScopeType.h" |
86 #include "public/web/WebViewClient.h" | 87 #include "public/web/WebViewClient.h" |
87 #include "public/web/WebWidget.h" | 88 #include "public/web/WebWidget.h" |
88 #include "public/web/WebWidgetClient.h" | 89 #include "public/web/WebWidgetClient.h" |
89 #include "testing/gtest/include/gtest/gtest.h" | 90 #include "testing/gtest/include/gtest/gtest.h" |
90 #include "third_party/skia/include/core/SkBitmap.h" | 91 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2218 { | 2219 { |
2219 ++m_count; | 2220 ++m_count; |
2220 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo
xFlags, frameOwnerProperties); | 2221 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo
xFlags, frameOwnerProperties); |
2221 } | 2222 } |
2222 | 2223 |
2223 TEST_F(WebViewTest, ChangeDisplayMode) | 2224 TEST_F(WebViewTest, ChangeDisplayMode) |
2224 { | 2225 { |
2225 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("display_mode.html")); | 2226 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("display_mode.html")); |
2226 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "display_mo
de.html", true); | 2227 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "display_mo
de.html", true); |
2227 | 2228 |
2228 std::string content = webView->mainFrame()->contentAsText(21).utf8(); | 2229 std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webView->ma
inFrame()->toWebLocalFrame(), 21).utf8(); |
2229 EXPECT_EQ("regular-ui", content); | 2230 EXPECT_EQ("regular-ui", content); |
2230 | 2231 |
2231 webView->setDisplayMode(WebDisplayModeMinimalUi); | 2232 webView->setDisplayMode(WebDisplayModeMinimalUi); |
2232 content = webView->mainFrame()->contentAsText(21).utf8(); | 2233 content = WebFrameContentDumper::dumpFrameTreeAsText(webView->mainFrame()->t
oWebLocalFrame(), 21).utf8(); |
2233 EXPECT_EQ("minimal-ui", content); | 2234 EXPECT_EQ("minimal-ui", content); |
2234 m_webViewHelper.reset(); | 2235 m_webViewHelper.reset(); |
2235 } | 2236 } |
2236 | 2237 |
2237 TEST_F(WebViewTest, AddFrameInCloseUnload) | 2238 TEST_F(WebViewTest, AddFrameInCloseUnload) |
2238 { | 2239 { |
2239 CreateChildCounterFrameClient frameClient; | 2240 CreateChildCounterFrameClient frameClient; |
2240 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("add_frame_in_unload.html")); | 2241 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("add_frame_in_unload.html")); |
2241 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr
ue, &frameClient); | 2242 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr
ue, &frameClient); |
2242 m_webViewHelper.reset(); | 2243 m_webViewHelper.reset(); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 TEST_F(WebViewTest, CompareSelectAllToContentAsText) | 2694 TEST_F(WebViewTest, CompareSelectAllToContentAsText) |
2694 { | 2695 { |
2695 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); | 2696 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); |
2696 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); | 2697 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); |
2697 | 2698 |
2698 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 2699 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
2699 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma
nd('SelectAll', false, null)"))); | 2700 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma
nd('SelectAll', false, null)"))); |
2700 std::string actual = frame->selectionAsText().utf8(); | 2701 std::string actual = frame->selectionAsText().utf8(); |
2701 | 2702 |
2702 const int kMaxOutputCharacters = 1024; | 2703 const int kMaxOutputCharacters = 1024; |
2703 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8(); | 2704 std::string expected = WebFrameContentDumper::dumpFrameTreeAsText(frame, kMa
xOutputCharacters).utf8(); |
2704 EXPECT_EQ(expected, actual); | 2705 EXPECT_EQ(expected, actual); |
2705 } | 2706 } |
2706 | 2707 |
2707 TEST_F(WebViewTest, AutoResizeSubtreeLayout) | 2708 TEST_F(WebViewTest, AutoResizeSubtreeLayout) |
2708 { | 2709 { |
2709 std::string url = m_baseURL + "subtree-layout.html"; | 2710 std::string url = m_baseURL + "subtree-layout.html"; |
2710 URLTestHelpers::registerMockedURLLoad(toKURL(url), "subtree-layout.html"); | 2711 URLTestHelpers::registerMockedURLLoad(toKURL(url), "subtree-layout.html"); |
2711 WebView* webView = m_webViewHelper.initialize(true); | 2712 WebView* webView = m_webViewHelper.initialize(true); |
2712 | 2713 |
2713 webView->enableAutoResizeMode(WebSize(200, 200), WebSize(200, 200)); | 2714 webView->enableAutoResizeMode(WebSize(200, 200), WebSize(200, 200)); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3226 result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baseline
Point); | 3227 result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baseline
Point); |
3227 ASSERT_TRUE(!!result); | 3228 ASSERT_TRUE(!!result); |
3228 | 3229 |
3229 point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y); | 3230 point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y); |
3230 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi
nt); | 3231 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi
nt); |
3231 ASSERT_TRUE(!!result); | 3232 ASSERT_TRUE(!!result); |
3232 } | 3233 } |
3233 #endif | 3234 #endif |
3234 | 3235 |
3235 } // namespace blink | 3236 } // namespace blink |
OLD | NEW |