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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2012823003: Move IME related functions from WebFrame to WebLocalFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CHECK in TextInputController::HasMarkedText() Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 518e3e54e8cf8c45fe8b245d4d89a8d34b9fd21f..70c11d36d35a392b60207a1fe4efb0d7f70c583b 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -3199,7 +3199,7 @@ TEST_P(ParameterizedWebFrameTest, CharacterIndexAtPointWithPinchZoom)
WebRect baseRect;
WebRect extentRect;
- WebFrame* mainFrame = webViewHelper.webViewImpl()->mainFrame();
+ WebLocalFrame* mainFrame = webViewHelper.webViewImpl()->mainFrame()->toWebLocalFrame();
size_t ix = mainFrame->characterIndexForPoint(WebPoint(320, 388));
EXPECT_EQ(2ul, ix);
@@ -3213,7 +3213,7 @@ TEST_P(ParameterizedWebFrameTest, FirstRectForCharacterRangeWithPinchZoom)
webViewHelper.initializeAndLoad(m_baseURL + "textbox.html", true);
webViewHelper.resize(WebSize(640, 480));
- WebFrame* mainFrame = webViewHelper.webViewImpl()->mainFrame();
+ WebLocalFrame* mainFrame = webViewHelper.webViewImpl()->mainFrame()->toWebLocalFrame();
mainFrame->executeScript(WebScriptSource("selectRange();"));
WebRect oldRect;
@@ -3668,7 +3668,7 @@ TEST_P(ParameterizedWebFrameTest, GetFullHtmlOfPage)
{
FrameTestHelpers::WebViewHelper webViewHelper(this);
webViewHelper.initializeAndLoad("about:blank", true);
- WebFrame* frame = webViewHelper.webView()->mainFrame();
+ WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
// Generate a simple test case.
const char simpleSource[] = "<p>Hello</p><p>World</p>";
@@ -3678,12 +3678,12 @@ TEST_P(ParameterizedWebFrameTest, GetFullHtmlOfPage)
WebString text = WebFrameContentDumper::dumpWebViewAsText(webViewHelper.webView(), std::numeric_limits<size_t>::max());
EXPECT_EQ("Hello\n\nWorld", text.utf8());
- const std::string html = WebFrameContentDumper::dumpAsMarkup(frame->toWebLocalFrame()).utf8();
+ const std::string html = WebFrameContentDumper::dumpAsMarkup(frame).utf8();
// Load again with the output html.
FrameTestHelpers::loadHTMLString(frame, html, testURL);
- EXPECT_EQ(html, WebFrameContentDumper::dumpAsMarkup(frame->toWebLocalFrame()).utf8());
+ EXPECT_EQ(html, WebFrameContentDumper::dumpAsMarkup(frame).utf8());
text = WebFrameContentDumper::dumpWebViewAsText(webViewHelper.webView(), std::numeric_limits<size_t>::max());
EXPECT_EQ("Hello\n\nWorld", text.utf8());
@@ -4131,12 +4131,12 @@ static WebRect elementBounds(WebFrame* frame, const WebString& id)
static std::string selectionAsString(WebFrame* frame)
{
- return frame->selectionAsText().utf8();
+ return frame->toWebLocalFrame()->selectionAsText().utf8();
}
TEST_P(ParameterizedWebFrameTest, SelectRange)
{
- WebFrame* frame;
+ WebLocalFrame* frame;
WebRect startWebRect;
WebRect endWebRect;
@@ -4145,7 +4145,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRange)
FrameTestHelpers::WebViewHelper webViewHelper(this);
initializeTextSelectionWebView(m_baseURL + "select_range_basic.html", &webViewHelper);
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
EXPECT_EQ("Some test text for testing.", selectionAsString(frame));
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
frame->executeCommand(WebString::fromUTF8("Unselect"));
@@ -4157,7 +4157,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRange)
|| selectionString == "Some test text for testing");
initializeTextSelectionWebView(m_baseURL + "select_range_scroll.html", &webViewHelper);
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame));
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
frame->executeCommand(WebString::fromUTF8("Unselect"));
@@ -4181,7 +4181,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeInIframe)
FrameTestHelpers::WebViewHelper webViewHelper(this);
initializeTextSelectionWebView(m_baseURL + "select_range_iframe.html", &webViewHelper);
frame = webViewHelper.webView()->mainFrame();
- WebFrame* subframe = frame->firstChild();
+ WebLocalFrame* subframe = frame->firstChild()->toWebLocalFrame();
EXPECT_EQ("Some test text for testing.", selectionAsString(subframe));
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
subframe->executeCommand(WebString::fromUTF8("Unselect"));
@@ -4195,7 +4195,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeInIframe)
TEST_P(ParameterizedWebFrameTest, SelectRangeDivContentEditable)
{
- WebFrame* frame;
+ WebLocalFrame* frame;
WebRect startWebRect;
WebRect endWebRect;
@@ -4205,7 +4205,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeDivContentEditable)
// The selection range should be clipped to the bounds of the editable element.
FrameTestHelpers::WebViewHelper webViewHelper(this);
initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper);
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
@@ -4214,7 +4214,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeDivContentEditable)
// As above, but extending the selection to the bottom of the document.
initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper);
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
@@ -4230,7 +4230,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeDivContentEditable)
// http://crbug.com/238334.
TEST_P(ParameterizedWebFrameTest, DISABLED_SelectRangeSpanContentEditable)
{
- WebFrame* frame;
+ WebLocalFrame* frame;
WebRect startWebRect;
WebRect endWebRect;
@@ -4240,7 +4240,7 @@ TEST_P(ParameterizedWebFrameTest, DISABLED_SelectRangeSpanContentEditable)
// The selection range should be clipped to the bounds of the editable element.
FrameTestHelpers::WebViewHelper webViewHelper(this);
initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", &webViewHelper);
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
@@ -4249,7 +4249,7 @@ TEST_P(ParameterizedWebFrameTest, DISABLED_SelectRangeSpanContentEditable)
// As above, but extending the selection to the bottom of the document.
initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", &webViewHelper);
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
@@ -4267,7 +4267,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeCanMoveSelectionStart)
registerMockedHttpURLLoad("text_selection.html");
FrameTestHelpers::WebViewHelper webViewHelper(this);
initializeTextSelectionWebView(m_baseURL + "text_selection.html", &webViewHelper);
- WebFrame* frame = webViewHelper.webView()->mainFrame();
+ WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
// Select second span. We can move the start to include the first span.
frame->executeScript(WebScriptSource("selectElement('header_2');"));
@@ -4315,7 +4315,7 @@ TEST_P(ParameterizedWebFrameTest, SelectRangeCanMoveSelectionEnd)
registerMockedHttpURLLoad("text_selection.html");
FrameTestHelpers::WebViewHelper webViewHelper(this);
initializeTextSelectionWebView(m_baseURL + "text_selection.html", &webViewHelper);
- WebFrame* frame = webViewHelper.webView()->mainFrame();
+ WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
// Select first span. We can move the end to include the second span.
frame->executeScript(WebScriptSource("selectElement('header_1');"));
@@ -4717,7 +4717,7 @@ TEST_P(ParameterizedWebFrameTest, CompositedSelectionBoundsCleared)
FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "select_range_basic.html");
// The frame starts with no selection.
- WebFrame* frame = webViewHelper.webView()->mainFrame();
+ WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
ASSERT_TRUE(frame->hasSelection());
EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared());
@@ -4748,7 +4748,7 @@ TEST_P(ParameterizedWebFrameTest, CompositedSelectionBoundsCleared)
ASSERT_TRUE(frame->hasSelection());
EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared());
- frame = webViewHelper.webView()->mainFrame();
+ frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame();
frame->executeCommand(WebString::fromUTF8("Unselect"));
webViewHelper.webView()->updateAllLifecyclePhases();
ASSERT_FALSE(frame->hasSelection());
@@ -5146,7 +5146,7 @@ TEST_P(ParameterizedWebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSele
WebFrame* frame = webViewHelper.webView()->mainFrame();
// This test passes if this doesn't crash.
- frame->moveCaretSelection(WebPoint(0, 0));
+ frame->toWebLocalFrame()->moveCaretSelection(WebPoint(0, 0));
}
class SpellCheckClient : public WebSpellCheckClient {

Powered by Google App Engine
This is Rietveld 408576698