| 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 23 matching lines...) Expand all Loading... |
| 34 #include <gtest/gtest.h> | 34 #include <gtest/gtest.h> |
| 35 #include "FrameTestHelpers.h" | 35 #include "FrameTestHelpers.h" |
| 36 #include "URLTestHelpers.h" | 36 #include "URLTestHelpers.h" |
| 37 #include "WebAutofillClient.h" | 37 #include "WebAutofillClient.h" |
| 38 #include "WebContentDetectionResult.h" | 38 #include "WebContentDetectionResult.h" |
| 39 #include "WebDateTimeChooserCompletion.h" | 39 #include "WebDateTimeChooserCompletion.h" |
| 40 #include "WebDocument.h" | 40 #include "WebDocument.h" |
| 41 #include "WebElement.h" | 41 #include "WebElement.h" |
| 42 #include "WebFrame.h" | 42 #include "WebFrame.h" |
| 43 #include "WebFrameClient.h" | 43 #include "WebFrameClient.h" |
| 44 #include "WebFrameImpl.h" | |
| 45 #include "WebHitTestResult.h" | 44 #include "WebHitTestResult.h" |
| 46 #include "WebInputEvent.h" | 45 #include "WebInputEvent.h" |
| 46 #include "WebLocalFrameImpl.h" |
| 47 #include "WebSettings.h" | 47 #include "WebSettings.h" |
| 48 #include "WebSettingsImpl.h" | 48 #include "WebSettingsImpl.h" |
| 49 #include "WebViewClient.h" | 49 #include "WebViewClient.h" |
| 50 #include "WebViewImpl.h" | 50 #include "WebViewImpl.h" |
| 51 #include "WebWidget.h" | 51 #include "WebWidget.h" |
| 52 #include "core/dom/Document.h" | 52 #include "core/dom/Document.h" |
| 53 #include "core/dom/Element.h" | 53 #include "core/dom/Element.h" |
| 54 #include "core/html/HTMLDocument.h" | 54 #include "core/html/HTMLDocument.h" |
| 55 #include "core/html/HTMLIFrameElement.h" | 55 #include "core/html/HTMLIFrameElement.h" |
| 56 #include "core/html/HTMLInputElement.h" | 56 #include "core/html/HTMLInputElement.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 EXPECT_TRUE(WebCore::greenChannel(color)); | 297 EXPECT_TRUE(WebCore::greenChannel(color)); |
| 298 } | 298 } |
| 299 | 299 |
| 300 TEST_F(WebViewTest, FocusIsInactive) | 300 TEST_F(WebViewTest, FocusIsInactive) |
| 301 { | 301 { |
| 302 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "visible_iframe.html"); | 302 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "visible_iframe.html"); |
| 303 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "visible_if
rame.html"); | 303 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "visible_if
rame.html"); |
| 304 | 304 |
| 305 webView->setFocus(true); | 305 webView->setFocus(true); |
| 306 webView->setIsActive(true); | 306 webView->setIsActive(true); |
| 307 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 307 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 308 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); | 308 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); |
| 309 | 309 |
| 310 WebCore::HTMLDocument* document = WebCore::toHTMLDocument(frame->frame()->do
cument()); | 310 WebCore::HTMLDocument* document = WebCore::toHTMLDocument(frame->frame()->do
cument()); |
| 311 EXPECT_TRUE(document->hasFocus()); | 311 EXPECT_TRUE(document->hasFocus()); |
| 312 webView->setFocus(false); | 312 webView->setFocus(false); |
| 313 webView->setIsActive(false); | 313 webView->setIsActive(false); |
| 314 EXPECT_FALSE(document->hasFocus()); | 314 EXPECT_FALSE(document->hasFocus()); |
| 315 webView->setFocus(true); | 315 webView->setFocus(true); |
| 316 webView->setIsActive(true); | 316 webView->setIsActive(true); |
| 317 EXPECT_TRUE(document->hasFocus()); | 317 EXPECT_TRUE(document->hasFocus()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 const std::string& pageWidth, const std::string
& pageHeight, | 366 const std::string& pageWidth, const std::string
& pageHeight, |
| 367 int expectedWidth, int expectedHeight, | 367 int expectedWidth, int expectedHeight, |
| 368 HorizontalScrollbarState expectedHorizontalStat
e, VerticalScrollbarState expectedVerticalState) | 368 HorizontalScrollbarState expectedHorizontalStat
e, VerticalScrollbarState expectedVerticalState) |
| 369 { | 369 { |
| 370 AutoResizeWebViewClient client; | 370 AutoResizeWebViewClient client; |
| 371 std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageH
eight; | 371 std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageH
eight; |
| 372 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); | 372 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); |
| 373 WebView* webView = m_webViewHelper.initializeAndLoad(url, true, 0, &client); | 373 WebView* webView = m_webViewHelper.initializeAndLoad(url, true, 0, &client); |
| 374 client.testData().setWebView(webView); | 374 client.testData().setWebView(webView); |
| 375 | 375 |
| 376 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 376 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 377 WebCore::FrameView* frameView = frame->frame()->view(); | 377 WebCore::FrameView* frameView = frame->frame()->view(); |
| 378 frameView->layout(); | 378 frameView->layout(); |
| 379 EXPECT_FALSE(frameView->layoutPending()); | 379 EXPECT_FALSE(frameView->layoutPending()); |
| 380 EXPECT_FALSE(frameView->needsLayout()); | 380 EXPECT_FALSE(frameView->needsLayout()); |
| 381 | 381 |
| 382 webView->enableAutoResizeMode(minAutoResize, maxAutoResize); | 382 webView->enableAutoResizeMode(minAutoResize, maxAutoResize); |
| 383 EXPECT_TRUE(frameView->layoutPending()); | 383 EXPECT_TRUE(frameView->layoutPending()); |
| 384 EXPECT_TRUE(frameView->needsLayout()); | 384 EXPECT_TRUE(frameView->needsLayout()); |
| 385 frameView->layout(); | 385 frameView->layout(); |
| 386 | 386 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 testInputMode(WebString("verbatim"), "input_mode_type_search_verbatim.html")
; | 504 testInputMode(WebString("verbatim"), "input_mode_type_search_verbatim.html")
; |
| 505 testInputMode(WebString(), "input_mode_type_url_verbatim.html"); | 505 testInputMode(WebString(), "input_mode_type_url_verbatim.html"); |
| 506 testInputMode(WebString("verbatim"), "input_mode_textarea_verbatim.html"); | 506 testInputMode(WebString("verbatim"), "input_mode_textarea_verbatim.html"); |
| 507 } | 507 } |
| 508 | 508 |
| 509 TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) | 509 TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) |
| 510 { | 510 { |
| 511 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 511 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 512 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); | 512 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 513 webView->setInitialFocus(false); | 513 webView->setInitialFocus(false); |
| 514 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 514 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 515 frame->setEditableSelectionOffsets(5, 13); | 515 frame->setEditableSelectionOffsets(5, 13); |
| 516 EXPECT_EQ("56789abc", frame->selectionAsText()); | 516 EXPECT_EQ("56789abc", frame->selectionAsText()); |
| 517 WebTextInputInfo info = webView->textInputInfo(); | 517 WebTextInputInfo info = webView->textInputInfo(); |
| 518 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", info.value); | 518 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", info.value); |
| 519 EXPECT_EQ(5, info.selectionStart); | 519 EXPECT_EQ(5, info.selectionStart); |
| 520 EXPECT_EQ(13, info.selectionEnd); | 520 EXPECT_EQ(13, info.selectionEnd); |
| 521 EXPECT_EQ(-1, info.compositionStart); | 521 EXPECT_EQ(-1, info.compositionStart); |
| 522 EXPECT_EQ(-1, info.compositionEnd); | 522 EXPECT_EQ(-1, info.compositionEnd); |
| 523 | 523 |
| 524 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("content_editable_populated.html")); | 524 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("content_editable_populated.html")); |
| 525 webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_po
pulated.html"); | 525 webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_po
pulated.html"); |
| 526 webView->setInitialFocus(false); | 526 webView->setInitialFocus(false); |
| 527 frame = toWebFrameImpl(webView->mainFrame()); | 527 frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 528 frame->setEditableSelectionOffsets(8, 19); | 528 frame->setEditableSelectionOffsets(8, 19); |
| 529 EXPECT_EQ("89abcdefghi", frame->selectionAsText()); | 529 EXPECT_EQ("89abcdefghi", frame->selectionAsText()); |
| 530 info = webView->textInputInfo(); | 530 info = webView->textInputInfo(); |
| 531 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", info.value); | 531 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", info.value); |
| 532 EXPECT_EQ(8, info.selectionStart); | 532 EXPECT_EQ(8, info.selectionStart); |
| 533 EXPECT_EQ(19, info.selectionEnd); | 533 EXPECT_EQ(19, info.selectionEnd); |
| 534 EXPECT_EQ(-1, info.compositionStart); | 534 EXPECT_EQ(-1, info.compositionStart); |
| 535 EXPECT_EQ(-1, info.compositionEnd); | 535 EXPECT_EQ(-1, info.compositionEnd); |
| 536 } | 536 } |
| 537 | 537 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 } | 578 } |
| 579 | 579 |
| 580 TEST_F(WebViewTest, InsertNewLinePlacementAfterConfirmComposition) | 580 TEST_F(WebViewTest, InsertNewLinePlacementAfterConfirmComposition) |
| 581 { | 581 { |
| 582 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); | 582 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); |
| 583 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_
populated.html"); | 583 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_
populated.html"); |
| 584 webView->setInitialFocus(false); | 584 webView->setInitialFocus(false); |
| 585 | 585 |
| 586 WebVector<WebCompositionUnderline> emptyUnderlines; | 586 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 587 | 587 |
| 588 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 588 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 589 frame->setEditableSelectionOffsets(4, 4); | 589 frame->setEditableSelectionOffsets(4, 4); |
| 590 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); | 590 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); |
| 591 | 591 |
| 592 WebTextInputInfo info = webView->textInputInfo(); | 592 WebTextInputInfo info = webView->textInputInfo(); |
| 593 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.utf
8().data())); | 593 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.utf
8().data())); |
| 594 EXPECT_EQ(4, info.selectionStart); | 594 EXPECT_EQ(4, info.selectionStart); |
| 595 EXPECT_EQ(4, info.selectionEnd); | 595 EXPECT_EQ(4, info.selectionEnd); |
| 596 EXPECT_EQ(8, info.compositionStart); | 596 EXPECT_EQ(8, info.compositionStart); |
| 597 EXPECT_EQ(12, info.compositionEnd); | 597 EXPECT_EQ(12, info.compositionEnd); |
| 598 | 598 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 610 EXPECT_EQ(5, info.selectionEnd); | 610 EXPECT_EQ(5, info.selectionEnd); |
| 611 EXPECT_EQ(-1, info.compositionStart); | 611 EXPECT_EQ(-1, info.compositionStart); |
| 612 EXPECT_EQ(-1, info.compositionEnd); | 612 EXPECT_EQ(-1, info.compositionEnd); |
| 613 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u
tf8().data())); | 613 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 614 } | 614 } |
| 615 | 615 |
| 616 TEST_F(WebViewTest, ExtendSelectionAndDelete) | 616 TEST_F(WebViewTest, ExtendSelectionAndDelete) |
| 617 { | 617 { |
| 618 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 618 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 619 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); | 619 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 620 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 620 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 621 webView->setInitialFocus(false); | 621 webView->setInitialFocus(false); |
| 622 frame->setEditableSelectionOffsets(10, 10); | 622 frame->setEditableSelectionOffsets(10, 10); |
| 623 frame->extendSelectionAndDelete(5, 8); | 623 frame->extendSelectionAndDelete(5, 8); |
| 624 WebTextInputInfo info = webView->textInputInfo(); | 624 WebTextInputInfo info = webView->textInputInfo(); |
| 625 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); | 625 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); |
| 626 EXPECT_EQ(5, info.selectionStart); | 626 EXPECT_EQ(5, info.selectionStart); |
| 627 EXPECT_EQ(5, info.selectionEnd); | 627 EXPECT_EQ(5, info.selectionEnd); |
| 628 frame->extendSelectionAndDelete(10, 0); | 628 frame->extendSelectionAndDelete(10, 0); |
| 629 info = webView->textInputInfo(); | 629 info = webView->textInputInfo(); |
| 630 EXPECT_EQ("ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); | 630 EXPECT_EQ("ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); |
| 631 } | 631 } |
| 632 | 632 |
| 633 TEST_F(WebViewTest, SetCompositionFromExistingText) | 633 TEST_F(WebViewTest, SetCompositionFromExistingText) |
| 634 { | 634 { |
| 635 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 635 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 636 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); | 636 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 637 webView->setInitialFocus(false); | 637 webView->setInitialFocus(false); |
| 638 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); | 638 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); |
| 639 underlines[0] = blink::WebCompositionUnderline(0, 4, 0, false); | 639 underlines[0] = blink::WebCompositionUnderline(0, 4, 0, false); |
| 640 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 640 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 641 frame->setEditableSelectionOffsets(4, 10); | 641 frame->setEditableSelectionOffsets(4, 10); |
| 642 frame->setCompositionFromExistingText(8, 12, underlines); | 642 frame->setCompositionFromExistingText(8, 12, underlines); |
| 643 WebVector<WebCompositionUnderline> underlineResults = toWebViewImpl(webView)
->compositionUnderlines(); | 643 WebVector<WebCompositionUnderline> underlineResults = toWebViewImpl(webView)
->compositionUnderlines(); |
| 644 EXPECT_EQ(8u, underlineResults[0].startOffset); | 644 EXPECT_EQ(8u, underlineResults[0].startOffset); |
| 645 EXPECT_EQ(12u, underlineResults[0].endOffset); | 645 EXPECT_EQ(12u, underlineResults[0].endOffset); |
| 646 WebTextInputInfo info = webView->textInputInfo(); | 646 WebTextInputInfo info = webView->textInputInfo(); |
| 647 EXPECT_EQ(4, info.selectionStart); | 647 EXPECT_EQ(4, info.selectionStart); |
| 648 EXPECT_EQ(10, info.selectionEnd); | 648 EXPECT_EQ(10, info.selectionEnd); |
| 649 EXPECT_EQ(8, info.compositionStart); | 649 EXPECT_EQ(8, info.compositionStart); |
| 650 EXPECT_EQ(12, info.compositionEnd); | 650 EXPECT_EQ(12, info.compositionEnd); |
| 651 WebVector<WebCompositionUnderline> emptyUnderlines; | 651 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 652 frame->setCompositionFromExistingText(0, 0, emptyUnderlines); | 652 frame->setCompositionFromExistingText(0, 0, emptyUnderlines); |
| 653 info = webView->textInputInfo(); | 653 info = webView->textInputInfo(); |
| 654 EXPECT_EQ(4, info.selectionStart); | 654 EXPECT_EQ(4, info.selectionStart); |
| 655 EXPECT_EQ(10, info.selectionEnd); | 655 EXPECT_EQ(10, info.selectionEnd); |
| 656 EXPECT_EQ(-1, info.compositionStart); | 656 EXPECT_EQ(-1, info.compositionStart); |
| 657 EXPECT_EQ(-1, info.compositionEnd); | 657 EXPECT_EQ(-1, info.compositionEnd); |
| 658 } | 658 } |
| 659 | 659 |
| 660 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) | 660 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) |
| 661 { | 661 { |
| 662 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); | 662 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); |
| 663 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_
populated.html"); | 663 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_
populated.html"); |
| 664 webView->setInitialFocus(false); | 664 webView->setInitialFocus(false); |
| 665 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); | 665 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); |
| 666 underlines[0] = blink::WebCompositionUnderline(0, 4, 0, false); | 666 underlines[0] = blink::WebCompositionUnderline(0, 4, 0, false); |
| 667 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 667 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 668 frame->setEditableSelectionOffsets(27, 27); | 668 frame->setEditableSelectionOffsets(27, 27); |
| 669 std::string newLineText("\n"); | 669 std::string newLineText("\n"); |
| 670 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str())); | 670 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str())); |
| 671 WebTextInputInfo info = webView->textInputInfo(); | 671 WebTextInputInfo info = webView->textInputInfo(); |
| 672 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); | 672 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 673 | 673 |
| 674 frame->setEditableSelectionOffsets(31, 31); | 674 frame->setEditableSelectionOffsets(31, 31); |
| 675 frame->setCompositionFromExistingText(30, 34, underlines); | 675 frame->setCompositionFromExistingText(30, 34, underlines); |
| 676 WebVector<WebCompositionUnderline> underlineResults = toWebViewImpl(webView)
->compositionUnderlines(); | 676 WebVector<WebCompositionUnderline> underlineResults = toWebViewImpl(webView)
->compositionUnderlines(); |
| 677 EXPECT_EQ(2u, underlineResults[0].startOffset); | 677 EXPECT_EQ(2u, underlineResults[0].startOffset); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 706 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str()
)); | 706 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str()
)); |
| 707 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()),
emptyUnderlines, 5, 5); | 707 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()),
emptyUnderlines, 5, 5); |
| 708 | 708 |
| 709 WebTextInputInfo info = webView->textInputInfo(); | 709 WebTextInputInfo info = webView->textInputInfo(); |
| 710 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); | 710 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); |
| 711 EXPECT_EQ(11, info.selectionStart); | 711 EXPECT_EQ(11, info.selectionStart); |
| 712 EXPECT_EQ(11, info.selectionEnd); | 712 EXPECT_EQ(11, info.selectionEnd); |
| 713 EXPECT_EQ(6, info.compositionStart); | 713 EXPECT_EQ(6, info.compositionStart); |
| 714 EXPECT_EQ(11, info.compositionEnd); | 714 EXPECT_EQ(11, info.compositionEnd); |
| 715 | 715 |
| 716 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 716 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 717 frame->setEditableSelectionOffsets(6, 6); | 717 frame->setEditableSelectionOffsets(6, 6); |
| 718 info = webView->textInputInfo(); | 718 info = webView->textInputInfo(); |
| 719 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); | 719 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); |
| 720 EXPECT_EQ(6, info.selectionStart); | 720 EXPECT_EQ(6, info.selectionStart); |
| 721 EXPECT_EQ(6, info.selectionEnd); | 721 EXPECT_EQ(6, info.selectionEnd); |
| 722 EXPECT_EQ(6, info.compositionStart); | 722 EXPECT_EQ(6, info.compositionStart); |
| 723 EXPECT_EQ(11, info.compositionEnd); | 723 EXPECT_EQ(11, info.compositionEnd); |
| 724 | 724 |
| 725 frame->setEditableSelectionOffsets(8, 8); | 725 frame->setEditableSelectionOffsets(8, 8); |
| 726 info = webView->textInputInfo(); | 726 info = webView->textInputInfo(); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 { | 1039 { |
| 1040 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); | 1040 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); |
| 1041 | 1041 |
| 1042 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); | 1042 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); |
| 1043 webView->resize(WebSize(500, 300)); | 1043 webView->resize(WebSize(500, 300)); |
| 1044 webView->layout(); | 1044 webView->layout(); |
| 1045 runPendingTasks(); | 1045 runPendingTasks(); |
| 1046 | 1046 |
| 1047 WebString target = WebString::fromUTF8("target"); | 1047 WebString target = WebString::fromUTF8("target"); |
| 1048 WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); | 1048 WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); |
| 1049 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1049 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1050 | 1050 |
| 1051 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, onselec
tstartfalse)); | 1051 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, onselec
tstartfalse)); |
| 1052 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); | 1052 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); |
| 1053 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); | 1053 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); |
| 1054 EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data())); | 1054 EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data())); |
| 1055 } | 1055 } |
| 1056 #endif | 1056 #endif |
| 1057 | 1057 |
| 1058 TEST_F(WebViewTest, SelectionOnDisabledInput) | 1058 TEST_F(WebViewTest, SelectionOnDisabledInput) |
| 1059 { | 1059 { |
| 1060 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("selection_disabled.html")); | 1060 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("selection_disabled.html")); |
| 1061 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_
disabled.html", true); | 1061 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_
disabled.html", true); |
| 1062 webView->resize(WebSize(640, 480)); | 1062 webView->resize(WebSize(640, 480)); |
| 1063 webView->layout(); | 1063 webView->layout(); |
| 1064 runPendingTasks(); | 1064 runPendingTasks(); |
| 1065 | 1065 |
| 1066 std::string testWord = "This text should be selected."; | 1066 std::string testWord = "This text should be selected."; |
| 1067 | 1067 |
| 1068 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1068 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1069 EXPECT_EQ(testWord, std::string(frame->selectionAsText().utf8().data())); | 1069 EXPECT_EQ(testWord, std::string(frame->selectionAsText().utf8().data())); |
| 1070 | 1070 |
| 1071 size_t location; | 1071 size_t location; |
| 1072 size_t length; | 1072 size_t length; |
| 1073 EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length
)); | 1073 EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length
)); |
| 1074 EXPECT_EQ(location, 0UL); | 1074 EXPECT_EQ(location, 0UL); |
| 1075 EXPECT_EQ(length, testWord.length()); | 1075 EXPECT_EQ(length, testWord.length()); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 TEST_F(WebViewTest, SelectionOnReadOnlyInput) | 1078 TEST_F(WebViewTest, SelectionOnReadOnlyInput) |
| 1079 { | 1079 { |
| 1080 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("selection_readonly.html")); | 1080 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("selection_readonly.html")); |
| 1081 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_
readonly.html", true); | 1081 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_
readonly.html", true); |
| 1082 webView->resize(WebSize(640, 480)); | 1082 webView->resize(WebSize(640, 480)); |
| 1083 webView->layout(); | 1083 webView->layout(); |
| 1084 runPendingTasks(); | 1084 runPendingTasks(); |
| 1085 | 1085 |
| 1086 std::string testWord = "This text should be selected."; | 1086 std::string testWord = "This text should be selected."; |
| 1087 | 1087 |
| 1088 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1088 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1089 EXPECT_EQ(testWord, std::string(frame->selectionAsText().utf8().data())); | 1089 EXPECT_EQ(testWord, std::string(frame->selectionAsText().utf8().data())); |
| 1090 | 1090 |
| 1091 size_t location; | 1091 size_t location; |
| 1092 size_t length; | 1092 size_t length; |
| 1093 EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length
)); | 1093 EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length
)); |
| 1094 EXPECT_EQ(location, 0UL); | 1094 EXPECT_EQ(location, 0UL); |
| 1095 EXPECT_EQ(length, testWord.length()); | 1095 EXPECT_EQ(length, testWord.length()); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 static void configueCompositingWebView(WebSettings* settings) | 1098 static void configueCompositingWebView(WebSettings* settings) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 TEST_F(WebViewTest, LosingFocusDoesNotTriggerAutofillTextChange) | 1169 TEST_F(WebViewTest, LosingFocusDoesNotTriggerAutofillTextChange) |
| 1170 { | 1170 { |
| 1171 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 1171 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 1172 MockAutofillClient client; | 1172 MockAutofillClient client; |
| 1173 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); | 1173 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 1174 webView->setAutofillClient(&client); | 1174 webView->setAutofillClient(&client); |
| 1175 webView->setInitialFocus(false); | 1175 webView->setInitialFocus(false); |
| 1176 | 1176 |
| 1177 // Set up a composition that needs to be committed. | 1177 // Set up a composition that needs to be committed. |
| 1178 WebVector<WebCompositionUnderline> emptyUnderlines; | 1178 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 1179 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1179 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1180 frame->setEditableSelectionOffsets(4, 10); | 1180 frame->setEditableSelectionOffsets(4, 10); |
| 1181 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); | 1181 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); |
| 1182 WebTextInputInfo info = webView->textInputInfo(); | 1182 WebTextInputInfo info = webView->textInputInfo(); |
| 1183 EXPECT_EQ(4, info.selectionStart); | 1183 EXPECT_EQ(4, info.selectionStart); |
| 1184 EXPECT_EQ(10, info.selectionEnd); | 1184 EXPECT_EQ(10, info.selectionEnd); |
| 1185 EXPECT_EQ(8, info.compositionStart); | 1185 EXPECT_EQ(8, info.compositionStart); |
| 1186 EXPECT_EQ(12, info.compositionEnd); | 1186 EXPECT_EQ(12, info.compositionEnd); |
| 1187 | 1187 |
| 1188 // Clear the focus and track that the subsequent composition commit does not
trigger a | 1188 // Clear the focus and track that the subsequent composition commit does not
trigger a |
| 1189 // text changed notification for autofill. | 1189 // text changed notification for autofill. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 { | 1227 { |
| 1228 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 1228 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 1229 MockAutofillClient client; | 1229 MockAutofillClient client; |
| 1230 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html", true); | 1230 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html", true); |
| 1231 webView->setAutofillClient(&client); | 1231 webView->setAutofillClient(&client); |
| 1232 webView->setInitialFocus(false); | 1232 webView->setInitialFocus(false); |
| 1233 | 1233 |
| 1234 WebVector<WebCompositionUnderline> emptyUnderlines; | 1234 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 1235 | 1235 |
| 1236 client.clearChangeCounts(); | 1236 client.clearChangeCounts(); |
| 1237 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1237 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1238 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); | 1238 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); |
| 1239 | 1239 |
| 1240 WebTextInputInfo info = webView->textInputInfo(); | 1240 WebTextInputInfo info = webView->textInputInfo(); |
| 1241 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.utf
8().data())); | 1241 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.utf
8().data())); |
| 1242 EXPECT_EQ(8, info.compositionStart); | 1242 EXPECT_EQ(8, info.compositionStart); |
| 1243 EXPECT_EQ(12, info.compositionEnd); | 1243 EXPECT_EQ(12, info.compositionEnd); |
| 1244 | 1244 |
| 1245 EXPECT_EQ(0, client.textChangesWhileIgnored()); | 1245 EXPECT_EQ(0, client.textChangesWhileIgnored()); |
| 1246 EXPECT_EQ(0, client.textChangesWhileNotIgnored()); | 1246 EXPECT_EQ(0, client.textChangesWhileNotIgnored()); |
| 1247 | 1247 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 FrameTestHelpers::WebViewHelper m_webViewHelper; | 1297 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 1298 bool m_didFocusCalled; | 1298 bool m_didFocusCalled; |
| 1299 }; | 1299 }; |
| 1300 | 1300 |
| 1301 TEST_F(WebViewTest, FocusExistingFrameOnNavigate) | 1301 TEST_F(WebViewTest, FocusExistingFrameOnNavigate) |
| 1302 { | 1302 { |
| 1303 ViewCreatingWebViewClient client; | 1303 ViewCreatingWebViewClient client; |
| 1304 FrameTestHelpers::WebViewHelper m_webViewHelper; | 1304 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 1305 WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); | 1305 WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); |
| 1306 webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(tru
e); | 1306 webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(tru
e); |
| 1307 WebFrameImpl* frame = toWebFrameImpl(webViewImpl->mainFrame()); | 1307 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); |
| 1308 frame->setName("_start"); | 1308 frame->setName("_start"); |
| 1309 | 1309 |
| 1310 // Make a request that will open a new window | 1310 // Make a request that will open a new window |
| 1311 WebURLRequest webURLRequest; | 1311 WebURLRequest webURLRequest; |
| 1312 webURLRequest.initialize(); | 1312 webURLRequest.initialize(); |
| 1313 WebCore::FrameLoadRequest request(0, webURLRequest.toResourceRequest(), "_bl
ank"); | 1313 WebCore::FrameLoadRequest request(0, webURLRequest.toResourceRequest(), "_bl
ank"); |
| 1314 webViewImpl->page()->mainFrame()->loader().load(request); | 1314 webViewImpl->page()->mainFrame()->loader().load(request); |
| 1315 ASSERT_TRUE(client.createdWebView()); | 1315 ASSERT_TRUE(client.createdWebView()); |
| 1316 EXPECT_FALSE(client.didFocusCalled()); | 1316 EXPECT_FALSE(client.didFocusCalled()); |
| 1317 | 1317 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 void WebViewTest::testSelectionRootBounds(const char* htmlFile, float pageScaleF
actor) | 1680 void WebViewTest::testSelectionRootBounds(const char* htmlFile, float pageScaleF
actor) |
| 1681 { | 1681 { |
| 1682 std::string url = m_baseURL + htmlFile; | 1682 std::string url = m_baseURL + htmlFile; |
| 1683 | 1683 |
| 1684 WebView* webView = m_webViewHelper.initializeAndLoad(url, true); | 1684 WebView* webView = m_webViewHelper.initializeAndLoad(url, true); |
| 1685 webView->resize(WebSize(640, 480)); | 1685 webView->resize(WebSize(640, 480)); |
| 1686 webView->setPageScaleFactor(pageScaleFactor); | 1686 webView->setPageScaleFactor(pageScaleFactor); |
| 1687 webView->layout(); | 1687 webView->layout(); |
| 1688 runPendingTasks(); | 1688 runPendingTasks(); |
| 1689 | 1689 |
| 1690 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1690 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1691 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); | 1691 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); |
| 1692 WebCore::HTMLDocument* document = WebCore::toHTMLDocument(frame->frame()->do
cument()); | 1692 WebCore::HTMLDocument* document = WebCore::toHTMLDocument(frame->frame()->do
cument()); |
| 1693 | 1693 |
| 1694 WebRect expectedRootBounds = ExpectedRootBounds(document, webView->pageScale
Factor()); | 1694 WebRect expectedRootBounds = ExpectedRootBounds(document, webView->pageScale
Factor()); |
| 1695 WebRect actualRootBounds; | 1695 WebRect actualRootBounds; |
| 1696 webView->getSelectionRootBounds(actualRootBounds); | 1696 webView->getSelectionRootBounds(actualRootBounds); |
| 1697 ASSERT_EQ(expectedRootBounds, actualRootBounds); | 1697 ASSERT_EQ(expectedRootBounds, actualRootBounds); |
| 1698 | 1698 |
| 1699 WebRect anchor, focus; | 1699 WebRect anchor, focus; |
| 1700 webView->selectionBounds(anchor, focus); | 1700 webView->selectionBounds(anchor, focus); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 WebSize contentSize = WebSize(640, 480); | 1756 WebSize contentSize = WebSize(640, 480); |
| 1757 | 1757 |
| 1758 registerMockedHttpURLLoad("select_range_basic_broken_height.html"); | 1758 registerMockedHttpURLLoad("select_range_basic_broken_height.html"); |
| 1759 | 1759 |
| 1760 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "select_ran
ge_basic_broken_height.html", true); | 1760 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "select_ran
ge_basic_broken_height.html", true); |
| 1761 webView->resize(contentSize); | 1761 webView->resize(contentSize); |
| 1762 webView->setPageScaleFactor(1.0f, WebPoint(0, 0)); | 1762 webView->setPageScaleFactor(1.0f, WebPoint(0, 0)); |
| 1763 webView->layout(); | 1763 webView->layout(); |
| 1764 runPendingTasks(); | 1764 runPendingTasks(); |
| 1765 | 1765 |
| 1766 WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame()); | 1766 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1767 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); | 1767 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); |
| 1768 | 1768 |
| 1769 WebRect expectedRootBounds = WebRect(0, 0, contentSize.width, contentSize.he
ight); | 1769 WebRect expectedRootBounds = WebRect(0, 0, contentSize.width, contentSize.he
ight); |
| 1770 WebRect actualRootBounds; | 1770 WebRect actualRootBounds; |
| 1771 webView->getSelectionRootBounds(actualRootBounds); | 1771 webView->getSelectionRootBounds(actualRootBounds); |
| 1772 ASSERT_EQ(expectedRootBounds, actualRootBounds); | 1772 ASSERT_EQ(expectedRootBounds, actualRootBounds); |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 class NonUserInputTextUpdateWebViewClient : public WebViewClient { | 1775 class NonUserInputTextUpdateWebViewClient : public WebViewClient { |
| 1776 public: | 1776 public: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1799 // This test verifies that WebWidgetClient::didUpdateTextOfFocusedElementByNonUs
erInput is | 1799 // This test verifies that WebWidgetClient::didUpdateTextOfFocusedElementByNonUs
erInput is |
| 1800 // called iff value of a focused element is modified via script. | 1800 // called iff value of a focused element is modified via script. |
| 1801 TEST_F(WebViewTest, NonUserInputTextUpdate) | 1801 TEST_F(WebViewTest, NonUserInputTextUpdate) |
| 1802 { | 1802 { |
| 1803 NonUserInputTextUpdateWebViewClient client; | 1803 NonUserInputTextUpdateWebViewClient client; |
| 1804 std::string url = m_baseURL + "non_user_input_text_update.html"; | 1804 std::string url = m_baseURL + "non_user_input_text_update.html"; |
| 1805 URLTestHelpers::registerMockedURLLoad(toKURL(url), "non_user_input_text_upda
te.html"); | 1805 URLTestHelpers::registerMockedURLLoad(toKURL(url), "non_user_input_text_upda
te.html"); |
| 1806 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); | 1806 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); |
| 1807 webViewImpl->setInitialFocus(false); | 1807 webViewImpl->setInitialFocus(false); |
| 1808 | 1808 |
| 1809 WebFrameImpl* frame = toWebFrameImpl(webViewImpl->mainFrame()); | 1809 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); |
| 1810 WebCore::HTMLDocument* document = WebCore::toHTMLDocument(frame->frame()->do
cument()); | 1810 WebCore::HTMLDocument* document = WebCore::toHTMLDocument(frame->frame()->do
cument()); |
| 1811 | 1811 |
| 1812 // (A) <input> | 1812 // (A) <input> |
| 1813 // (A.1) Focused and value is changed by script. | 1813 // (A.1) Focused and value is changed by script. |
| 1814 client.reset(); | 1814 client.reset(); |
| 1815 EXPECT_FALSE(client.textIsUpdated()); | 1815 EXPECT_FALSE(client.textIsUpdated()); |
| 1816 | 1816 |
| 1817 WebCore::HTMLInputElement* inputElement = toHTMLInputElement(document->getEl
ementById("input")); | 1817 WebCore::HTMLInputElement* inputElement = toHTMLInputElement(document->getEl
ementById("input")); |
| 1818 document->setFocusedElement(inputElement); | 1818 document->setFocusedElement(inputElement); |
| 1819 webViewImpl->setFocus(true); | 1819 webViewImpl->setFocus(true); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 | 1934 |
| 1935 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 1935 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
| 1936 | 1936 |
| 1937 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); | 1937 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); |
| 1938 | 1938 |
| 1939 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 1939 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
| 1940 webView->setAutofillClient(0); | 1940 webView->setAutofillClient(0); |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 } // namespace | 1943 } // namespace |
| OLD | NEW |