| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3557 } | 3557 } |
| 3558 EXPECT_EQ(1, matchCount); | 3558 EXPECT_EQ(1, matchCount); |
| 3559 } | 3559 } |
| 3560 | 3560 |
| 3561 TEST_P(ParameterizedWebFrameTest, FindInPage) | 3561 TEST_P(ParameterizedWebFrameTest, FindInPage) |
| 3562 { | 3562 { |
| 3563 registerMockedHttpURLLoad("find.html"); | 3563 registerMockedHttpURLLoad("find.html"); |
| 3564 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3564 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3565 webViewHelper.initializeAndLoad(m_baseURL + "find.html"); | 3565 webViewHelper.initializeAndLoad(m_baseURL + "find.html"); |
| 3566 ASSERT_TRUE(webViewHelper.webView()->mainFrame()->isWebLocalFrame()); | 3566 ASSERT_TRUE(webViewHelper.webView()->mainFrame()->isWebLocalFrame()); |
| 3567 webViewHelper.webView()->setFocus(true); |
| 3567 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); | 3568 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); |
| 3568 const int findIdentifier = 12345; | 3569 const int findIdentifier = 12345; |
| 3569 WebFindOptions options; | 3570 WebFindOptions options; |
| 3570 | 3571 |
| 3571 // Find in a <div> element. | 3572 // Find in a <div> element. |
| 3572 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar1"), options
, false, 0)); | 3573 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar1"), options
, false, 0)); |
| 3573 frame->stopFinding(false); | 3574 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 3574 WebRange range = frame->selectionRange(); | 3575 WebRange range = frame->selectionRange(); |
| 3575 EXPECT_EQ(5, range.startOffset()); | 3576 EXPECT_EQ(5, range.startOffset()); |
| 3576 EXPECT_EQ(9, range.endOffset()); | 3577 EXPECT_EQ(9, range.endOffset()); |
| 3577 EXPECT_TRUE(frame->document().focusedElement().isNull()); | 3578 EXPECT_TRUE(frame->document().focusedElement().isNull()); |
| 3578 | 3579 |
| 3579 // Find in an <input> value. | 3580 // Find in an <input> value. |
| 3580 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar2"), options
, false, 0)); | 3581 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar2"), options
, false, 0)); |
| 3581 // Confirm stopFinding(false) sets the selection on the found text. | 3582 // Confirm stopFinding(WebLocalFrame::StopFindActionKeepSelection) sets the
selection on the found text. |
| 3582 frame->stopFinding(false); | 3583 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 3583 range = frame->selectionRange(); | 3584 range = frame->selectionRange(); |
| 3584 ASSERT_FALSE(range.isNull()); | 3585 ASSERT_FALSE(range.isNull()); |
| 3585 EXPECT_EQ(5, range.startOffset()); | 3586 EXPECT_EQ(5, range.startOffset()); |
| 3586 EXPECT_EQ(9, range.endOffset()); | 3587 EXPECT_EQ(9, range.endOffset()); |
| 3587 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("input")); | 3588 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("input")); |
| 3588 | 3589 |
| 3589 // Find in a <textarea> content. | 3590 // Find in a <textarea> content. |
| 3590 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar3"), options
, false, 0)); | 3591 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar3"), options
, false, 0)); |
| 3591 // Confirm stopFinding(false) sets the selection on the found text. | 3592 // Confirm stopFinding(WebLocalFrame::StopFindActionKeepSelection) sets the
selection on the found text. |
| 3592 frame->stopFinding(false); | 3593 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 3593 range = frame->selectionRange(); | 3594 range = frame->selectionRange(); |
| 3594 ASSERT_FALSE(range.isNull()); | 3595 ASSERT_FALSE(range.isNull()); |
| 3595 EXPECT_EQ(5, range.startOffset()); | 3596 EXPECT_EQ(5, range.startOffset()); |
| 3596 EXPECT_EQ(9, range.endOffset()); | 3597 EXPECT_EQ(9, range.endOffset()); |
| 3597 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("textarea")); | 3598 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("textarea")); |
| 3598 | 3599 |
| 3599 // Find in a contentEditable element. | 3600 // Find in a contentEditable element. |
| 3600 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar4"), options
, false, 0)); | 3601 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar4"), options
, false, 0)); |
| 3601 // Confirm stopFinding(false) sets the selection on the found text. | 3602 // Confirm stopFinding(WebLocalFrame::StopFindActionKeepSelection) sets the
selection on the found text. |
| 3602 frame->stopFinding(false); | 3603 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 3603 range = frame->selectionRange(); | 3604 range = frame->selectionRange(); |
| 3604 ASSERT_FALSE(range.isNull()); | 3605 ASSERT_FALSE(range.isNull()); |
| 3605 EXPECT_EQ(0, range.startOffset()); | 3606 EXPECT_EQ(0, range.startOffset()); |
| 3606 EXPECT_EQ(4, range.endOffset()); | 3607 EXPECT_EQ(4, range.endOffset()); |
| 3607 // "bar4" is surrounded by <span>, but the focusable node should be the pare
nt <div>. | 3608 // "bar4" is surrounded by <span>, but the focusable node should be the pare
nt <div>. |
| 3608 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("div")); | 3609 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("div")); |
| 3609 | 3610 |
| 3610 // Find in <select> content. | 3611 // Find in <select> content. |
| 3611 EXPECT_FALSE(frame->find(findIdentifier, WebString::fromUTF8("bar5"), option
s, false, 0)); | 3612 EXPECT_FALSE(frame->find(findIdentifier, WebString::fromUTF8("bar5"), option
s, false, 0)); |
| 3612 // If there are any matches, stopFinding will set the selection on the found
text. | 3613 // If there are any matches, stopFinding will set the selection on the found
text. |
| 3613 // However, we do not expect any matches, so check that the selection is nul
l. | 3614 // However, we do not expect any matches, so check that the selection is nul
l. |
| 3614 frame->stopFinding(false); | 3615 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 3615 range = frame->selectionRange(); | 3616 range = frame->selectionRange(); |
| 3616 ASSERT_TRUE(range.isNull()); | 3617 ASSERT_TRUE(range.isNull()); |
| 3617 } | 3618 } |
| 3618 | 3619 |
| 3619 TEST_P(ParameterizedWebFrameTest, GetContentAsPlainText) | 3620 TEST_P(ParameterizedWebFrameTest, GetContentAsPlainText) |
| 3620 { | 3621 { |
| 3621 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3622 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3622 webViewHelper.initializeAndLoad("about:blank", true); | 3623 webViewHelper.initializeAndLoad("about:blank", true); |
| 3623 // We set the size because it impacts line wrapping, which changes the | 3624 // We set the size because it impacts line wrapping, which changes the |
| 3624 // resulting text value. | 3625 // resulting text value. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3737 int activeIndex() const { return m_activeIndex; } | 3738 int activeIndex() const { return m_activeIndex; } |
| 3738 | 3739 |
| 3739 private: | 3740 private: |
| 3740 bool m_findResultsAreReady; | 3741 bool m_findResultsAreReady; |
| 3741 int m_count; | 3742 int m_count; |
| 3742 int m_activeIndex; | 3743 int m_activeIndex; |
| 3743 }; | 3744 }; |
| 3744 | 3745 |
| 3745 TEST_P(ParameterizedWebFrameTest, FindInPageMatchRects) | 3746 TEST_P(ParameterizedWebFrameTest, FindInPageMatchRects) |
| 3746 { | 3747 { |
| 3747 registerMockedHttpURLLoad("find_in_page.html"); | |
| 3748 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3748 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 3749 | 3749 |
| 3750 FindUpdateWebFrameClient client; | 3750 FindUpdateWebFrameClient client; |
| 3751 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3751 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3752 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3752 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page_frame.html", true,
&client); |
| 3753 webViewHelper.resize(WebSize(640, 480)); | 3753 webViewHelper.resize(WebSize(640, 480)); |
| 3754 webViewHelper.webView()->setMaximumLegibleScale(1.f); | 3754 webViewHelper.webView()->setMaximumLegibleScale(1.f); |
| 3755 webViewHelper.webView()->updateAllLifecyclePhases(); | 3755 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 3756 webViewHelper.webView()->setFocus(true); |
| 3756 runPendingTasks(); | 3757 runPendingTasks(); |
| 3757 | 3758 |
| 3758 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. | 3759 // Note that the 'result 19' in the <select> element is not expected to |
| 3760 // produce a match. Also, results 00 and 01 are in a different frame that is |
| 3761 // not included in this test. |
| 3759 const char kFindString[] = "result"; | 3762 const char kFindString[] = "result"; |
| 3760 const int kFindIdentifier = 12345; | 3763 const int kFindIdentifier = 12345; |
| 3761 const int kNumResults = 19; | 3764 const int kNumResults = 17; |
| 3762 | 3765 |
| 3763 WebFindOptions options; | 3766 WebFindOptions options; |
| 3764 WebString searchText = WebString::fromUTF8(kFindString); | 3767 WebString searchText = WebString::fromUTF8(kFindString); |
| 3765 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3768 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3766 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3769 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3767 | 3770 |
| 3768 mainFrame->resetMatchCount(); | 3771 mainFrame->resetMatchCount(); |
| 3769 | 3772 |
| 3770 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3773 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3771 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3774 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
| 3772 | 3775 |
| 3773 runPendingTasks(); | 3776 runPendingTasks(); |
| 3774 EXPECT_TRUE(client.findResultsAreReady()); | 3777 EXPECT_TRUE(client.findResultsAreReady()); |
| 3775 | 3778 |
| 3776 WebVector<WebFloatRect> webMatchRects; | 3779 WebVector<WebFloatRect> webMatchRects; |
| 3777 mainFrame->findMatchRects(webMatchRects); | 3780 mainFrame->findMatchRects(webMatchRects); |
| 3778 ASSERT_EQ(webMatchRects.size(), static_cast<size_t>(kNumResults)); | 3781 ASSERT_EQ(static_cast<size_t>(kNumResults), webMatchRects.size()); |
| 3779 int rectsVersion = mainFrame->findMatchMarkersVersion(); | 3782 int rectsVersion = mainFrame->findMatchMarkersVersion(); |
| 3780 | 3783 |
| 3781 for (int resultIndex = 0; resultIndex < kNumResults; ++resultIndex) { | 3784 for (int resultIndex = 0; resultIndex < kNumResults; ++resultIndex) { |
| 3782 FloatRect resultRect = static_cast<FloatRect>(webMatchRects[resultIndex]
); | 3785 FloatRect resultRect = static_cast<FloatRect>(webMatchRects[resultIndex]
); |
| 3783 | 3786 |
| 3784 // Select the match by the center of its rect. | 3787 // Select the match by the center of its rect. |
| 3785 EXPECT_EQ(mainFrame->selectNearestFindMatch(resultRect.center(), 0), res
ultIndex + 1); | 3788 EXPECT_EQ(mainFrame->selectNearestFindMatch(resultRect.center(), 0), res
ultIndex + 1); |
| 3786 | 3789 |
| 3787 // Check that the find result ordering matches with our expectations. | 3790 // Check that the find result ordering matches with our expectations. |
| 3788 Range* result = mainFrame->textFinder()->activeMatchFrame()->textFinder(
)->activeMatch(); | 3791 Range* result = mainFrame->textFinder()->activeMatch(); |
| 3789 ASSERT_TRUE(result); | 3792 ASSERT_TRUE(result); |
| 3790 result->setEnd(result->endContainer(), result->endOffset() + 3); | 3793 result->setEnd(result->endContainer(), result->endOffset() + 3); |
| 3791 EXPECT_EQ(result->text(), String::format("%s %02d", kFindString, resultI
ndex)); | 3794 EXPECT_EQ(result->text(), String::format("%s %02d", kFindString, resultI
ndex + 2)); |
| 3792 | 3795 |
| 3793 // Verify that the expected match rect also matches the currently active
match. | 3796 // Verify that the expected match rect also matches the currently active
match. |
| 3794 // Compare the enclosing rects to prevent precision issues caused by CSS
transforms. | 3797 // Compare the enclosing rects to prevent precision issues caused by CSS
transforms. |
| 3795 FloatRect activeMatch = mainFrame->activeFindMatchRect(); | 3798 FloatRect activeMatch = mainFrame->activeFindMatchRect(); |
| 3796 EXPECT_EQ(enclosingIntRect(activeMatch), enclosingIntRect(resultRect)); | 3799 EXPECT_EQ(enclosingIntRect(activeMatch), enclosingIntRect(resultRect)); |
| 3797 | 3800 |
| 3798 // The rects version should not have changed. | 3801 // The rects version should not have changed. |
| 3799 EXPECT_EQ(mainFrame->findMatchMarkersVersion(), rectsVersion); | 3802 EXPECT_EQ(mainFrame->findMatchMarkersVersion(), rectsVersion); |
| 3800 } | 3803 } |
| 3801 | 3804 |
| 3802 // All results after the first two ones should be below between them in find
-in-page coordinates. | |
| 3803 // This is because results 2 to 9 are inside an iframe located between resul
ts 0 and 1. This applies to the fixed div too. | |
| 3804 EXPECT_TRUE(webMatchRects[0].y < webMatchRects[1].y); | |
| 3805 for (int resultIndex = 2; resultIndex < kNumResults; ++resultIndex) { | |
| 3806 EXPECT_TRUE(webMatchRects[0].y < webMatchRects[resultIndex].y); | |
| 3807 EXPECT_TRUE(webMatchRects[1].y > webMatchRects[resultIndex].y); | |
| 3808 } | |
| 3809 | |
| 3810 // Result 3 should be below both 2 and 4. This is caused by the CSS transfor
m in the containing div. | |
| 3811 // If the transform doesn't work then 3 will be between 2 and 4. | |
| 3812 EXPECT_TRUE(webMatchRects[3].y > webMatchRects[2].y); | |
| 3813 EXPECT_TRUE(webMatchRects[3].y > webMatchRects[4].y); | |
| 3814 | |
| 3815 // Results 6, 7, 8 and 9 should be one below the other in that same order. | |
| 3816 // If overflow:scroll is not properly handled then result 8 would be below r
esult 9 or | |
| 3817 // result 7 above result 6 depending on the scroll. | |
| 3818 EXPECT_TRUE(webMatchRects[6].y < webMatchRects[7].y); | |
| 3819 EXPECT_TRUE(webMatchRects[7].y < webMatchRects[8].y); | |
| 3820 EXPECT_TRUE(webMatchRects[8].y < webMatchRects[9].y); | |
| 3821 | |
| 3822 // Results 11, 12, 13 and 14 should be between results 10 and 15, as they ar
e inside the table. | |
| 3823 EXPECT_TRUE(webMatchRects[11].y > webMatchRects[10].y); | |
| 3824 EXPECT_TRUE(webMatchRects[12].y > webMatchRects[10].y); | |
| 3825 EXPECT_TRUE(webMatchRects[13].y > webMatchRects[10].y); | |
| 3826 EXPECT_TRUE(webMatchRects[14].y > webMatchRects[10].y); | |
| 3827 EXPECT_TRUE(webMatchRects[11].y < webMatchRects[15].y); | |
| 3828 EXPECT_TRUE(webMatchRects[12].y < webMatchRects[15].y); | |
| 3829 EXPECT_TRUE(webMatchRects[13].y < webMatchRects[15].y); | |
| 3830 EXPECT_TRUE(webMatchRects[14].y < webMatchRects[15].y); | |
| 3831 | |
| 3832 // Result 11 should be above 12, 13 and 14 as it's in the table header. | |
| 3833 EXPECT_TRUE(webMatchRects[11].y < webMatchRects[12].y); | |
| 3834 EXPECT_TRUE(webMatchRects[11].y < webMatchRects[13].y); | |
| 3835 EXPECT_TRUE(webMatchRects[11].y < webMatchRects[14].y); | |
| 3836 | |
| 3837 // Result 11 should also be right to 12, 13 and 14 because of the colspan. | |
| 3838 EXPECT_TRUE(webMatchRects[11].x > webMatchRects[12].x); | |
| 3839 EXPECT_TRUE(webMatchRects[11].x > webMatchRects[13].x); | |
| 3840 EXPECT_TRUE(webMatchRects[11].x > webMatchRects[14].x); | |
| 3841 | |
| 3842 // Result 12 should be left to results 11, 13 and 14 in the table layout. | |
| 3843 EXPECT_TRUE(webMatchRects[12].x < webMatchRects[11].x); | |
| 3844 EXPECT_TRUE(webMatchRects[12].x < webMatchRects[13].x); | |
| 3845 EXPECT_TRUE(webMatchRects[12].x < webMatchRects[14].x); | |
| 3846 | |
| 3847 // Results 13, 12 and 14 should be one above the other in that order because
of the rowspan | |
| 3848 // and vertical-align: middle by default. | |
| 3849 EXPECT_TRUE(webMatchRects[13].y < webMatchRects[12].y); | |
| 3850 EXPECT_TRUE(webMatchRects[12].y < webMatchRects[14].y); | |
| 3851 | |
| 3852 // Result 16 should be below result 15. | |
| 3853 EXPECT_TRUE(webMatchRects[15].y > webMatchRects[14].y); | |
| 3854 | |
| 3855 // Result 18 should be normalized with respect to the position:relative div,
and not it's | |
| 3856 // immediate containing div. Consequently, result 18 should be above result
17. | |
| 3857 EXPECT_TRUE(webMatchRects[17].y > webMatchRects[18].y); | |
| 3858 | |
| 3859 // Resizing should update the rects version. | 3805 // Resizing should update the rects version. |
| 3860 webViewHelper.resize(WebSize(800, 600)); | 3806 webViewHelper.resize(WebSize(800, 600)); |
| 3861 runPendingTasks(); | 3807 runPendingTasks(); |
| 3862 EXPECT_TRUE(mainFrame->findMatchMarkersVersion() != rectsVersion); | 3808 EXPECT_TRUE(mainFrame->findMatchMarkersVersion() != rectsVersion); |
| 3863 } | 3809 } |
| 3864 | 3810 |
| 3865 TEST_F(WebFrameTest, FindInPageActiveIndex) | 3811 TEST_F(WebFrameTest, FindInPageActiveIndex) |
| 3866 { | 3812 { |
| 3867 registerMockedHttpURLLoad("find_match_count.html"); | 3813 registerMockedHttpURLLoad("find_match_count.html"); |
| 3868 | 3814 |
| 3869 FindUpdateWebFrameClient client; | 3815 FindUpdateWebFrameClient client; |
| 3870 FrameTestHelpers::WebViewHelper webViewHelper; | 3816 FrameTestHelpers::WebViewHelper webViewHelper; |
| 3871 webViewHelper.initializeAndLoad(m_baseURL + "find_match_count.html", true, &
client); | 3817 webViewHelper.initializeAndLoad(m_baseURL + "find_match_count.html", true, &
client); |
| 3872 webViewHelper.webView()->resize(WebSize(640, 480)); | 3818 webViewHelper.webView()->resize(WebSize(640, 480)); |
| 3819 webViewHelper.webView()->setFocus(true); |
| 3873 runPendingTasks(); | 3820 runPendingTasks(); |
| 3874 | 3821 |
| 3875 const char* kFindString = "a"; | 3822 const char* kFindString = "a"; |
| 3876 const int kFindIdentifier = 7777; | 3823 const int kFindIdentifier = 7777; |
| 3877 const int kActiveIndex = 1; | 3824 const int kActiveIndex = 1; |
| 3878 | 3825 |
| 3879 WebFindOptions options; | 3826 WebFindOptions options; |
| 3880 WebString searchText = WebString::fromUTF8(kFindString); | 3827 WebString searchText = WebString::fromUTF8(kFindString); |
| 3881 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3828 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3882 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3829 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3883 mainFrame->resetMatchCount(); | 3830 mainFrame->resetMatchCount(); |
| 3884 | 3831 |
| 3885 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3832 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3886 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3833 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
| 3887 | 3834 |
| 3888 runPendingTasks(); | 3835 runPendingTasks(); |
| 3889 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3836 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3890 mainFrame->stopFinding(true); | 3837 mainFrame->stopFinding(WebLocalFrame::StopFindActionClearSelection); |
| 3891 | 3838 |
| 3892 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3839 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3893 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3840 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
| 3894 | 3841 |
| 3895 runPendingTasks(); | 3842 runPendingTasks(); |
| 3896 EXPECT_TRUE(client.findResultsAreReady()); | 3843 EXPECT_TRUE(client.findResultsAreReady()); |
| 3897 EXPECT_EQ(kActiveIndex, client.activeIndex()); | 3844 EXPECT_EQ(kActiveIndex, client.activeIndex()); |
| 3898 | 3845 |
| 3899 const char* kFindStringNew = "e"; | 3846 const char* kFindStringNew = "e"; |
| 3900 WebString searchTextNew = WebString::fromUTF8(kFindStringNew); | 3847 WebString searchTextNew = WebString::fromUTF8(kFindStringNew); |
| 3901 | 3848 |
| 3902 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchTextNew, options, false,
0)); | 3849 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchTextNew, options, false,
0)); |
| 3903 mainFrame->resetMatchCount(); | 3850 mainFrame->resetMatchCount(); |
| 3904 | 3851 |
| 3905 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3852 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3906 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
New, options, true); | 3853 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
New, options, true); |
| 3907 | 3854 |
| 3908 runPendingTasks(); | 3855 runPendingTasks(); |
| 3909 EXPECT_TRUE(client.findResultsAreReady()); | 3856 EXPECT_TRUE(client.findResultsAreReady()); |
| 3910 EXPECT_EQ(kActiveIndex, client.activeIndex()); | 3857 EXPECT_EQ(kActiveIndex, client.activeIndex()); |
| 3911 } | 3858 } |
| 3912 | 3859 |
| 3913 TEST_P(ParameterizedWebFrameTest, FindInPageSkipsHiddenFrames) | |
| 3914 { | |
| 3915 registerMockedHttpURLLoad("find_in_hidden_frame.html"); | |
| 3916 | |
| 3917 FindUpdateWebFrameClient client; | |
| 3918 FrameTestHelpers::WebViewHelper webViewHelper(this); | |
| 3919 webViewHelper.initializeAndLoad(m_baseURL + "find_in_hidden_frame.html", tru
e, &client); | |
| 3920 webViewHelper.resize(WebSize(640, 480)); | |
| 3921 runPendingTasks(); | |
| 3922 | |
| 3923 const char kFindString[] = "hello"; | |
| 3924 const int kFindIdentifier = 12345; | |
| 3925 const int kNumResults = 1; | |
| 3926 | |
| 3927 WebFindOptions options; | |
| 3928 WebString searchText = WebString::fromUTF8(kFindString); | |
| 3929 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | |
| 3930 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | |
| 3931 | |
| 3932 mainFrame->resetMatchCount(); | |
| 3933 | |
| 3934 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | |
| 3935 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | |
| 3936 | |
| 3937 runPendingTasks(); | |
| 3938 EXPECT_TRUE(client.findResultsAreReady()); | |
| 3939 EXPECT_EQ(kNumResults, client.count()); | |
| 3940 } | |
| 3941 | |
| 3942 TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) | 3860 TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) |
| 3943 { | 3861 { |
| 3944 registerMockedHttpURLLoad("find_in_page.html"); | 3862 registerMockedHttpURLLoad("find_in_page.html"); |
| 3945 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3863 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 3946 | 3864 |
| 3947 FindUpdateWebFrameClient client; | 3865 FindUpdateWebFrameClient client; |
| 3948 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3866 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3949 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3867 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 3950 webViewHelper.resize(WebSize(640, 480)); | 3868 webViewHelper.resize(WebSize(640, 480)); |
| 3869 webViewHelper.webView()->setFocus(true); |
| 3951 runPendingTasks(); | 3870 runPendingTasks(); |
| 3952 | 3871 |
| 3953 const char kFindString[] = "result"; | 3872 const char kFindString[] = "result"; |
| 3954 const int kFindIdentifier = 12345; | 3873 const int kFindIdentifier = 12345; |
| 3955 | 3874 |
| 3956 WebFindOptions options; | 3875 WebFindOptions options; |
| 3957 WebString searchText = WebString::fromUTF8(kFindString); | 3876 WebString searchText = WebString::fromUTF8(kFindString); |
| 3958 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3877 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3959 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); | 3878 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); |
| 3960 | 3879 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3978 | 3897 |
| 3979 TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) | 3898 TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) |
| 3980 { | 3899 { |
| 3981 registerMockedHttpURLLoad("find_in_page.html"); | 3900 registerMockedHttpURLLoad("find_in_page.html"); |
| 3982 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3901 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 3983 | 3902 |
| 3984 FindUpdateWebFrameClient client; | 3903 FindUpdateWebFrameClient client; |
| 3985 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3904 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3986 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3905 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 3987 webViewHelper.resize(WebSize(640, 480)); | 3906 webViewHelper.resize(WebSize(640, 480)); |
| 3907 webViewHelper.webView()->setFocus(true); |
| 3988 runPendingTasks(); | 3908 runPendingTasks(); |
| 3989 | 3909 |
| 3990 const char kFindString[] = "result"; | 3910 const char kFindString[] = "result"; |
| 3991 const int kFindIdentifier = 12345; | 3911 const int kFindIdentifier = 12345; |
| 3992 | 3912 |
| 3993 WebFindOptions options; | 3913 WebFindOptions options; |
| 3994 WebString searchText = WebString::fromUTF8(kFindString); | 3914 WebString searchText = WebString::fromUTF8(kFindString); |
| 3995 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3915 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3996 | 3916 |
| 3997 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3917 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
{ |
| 3918 webViewHelper.webView()->setFocusedFrame(frame); |
| 3998 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); | 3919 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); |
| 3920 } |
| 3999 | 3921 |
| 4000 runPendingTasks(); | 3922 runPendingTasks(); |
| 4001 EXPECT_FALSE(client.findResultsAreReady()); | 3923 EXPECT_FALSE(client.findResultsAreReady()); |
| 4002 | 3924 |
| 4003 // Detach the frame between finding and scoping. | 3925 // Detach the frame between finding and scoping. |
| 4004 removeElementById(mainFrame, "frame"); | 3926 removeElementById(mainFrame, "frame"); |
| 4005 | 3927 |
| 4006 mainFrame->resetMatchCount(); | 3928 mainFrame->resetMatchCount(); |
| 4007 | 3929 |
| 4008 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3930 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 4009 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3931 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
| 4010 | 3932 |
| 4011 runPendingTasks(); | 3933 runPendingTasks(); |
| 4012 EXPECT_TRUE(client.findResultsAreReady()); | 3934 EXPECT_TRUE(client.findResultsAreReady()); |
| 4013 } | 3935 } |
| 4014 | 3936 |
| 4015 TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) | 3937 TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) |
| 4016 { | 3938 { |
| 4017 registerMockedHttpURLLoad("find_in_page.html"); | 3939 registerMockedHttpURLLoad("find_in_page.html"); |
| 4018 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3940 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 4019 | 3941 |
| 4020 FindUpdateWebFrameClient client; | 3942 FindUpdateWebFrameClient client; |
| 4021 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3943 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4022 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3944 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 4023 webViewHelper.resize(WebSize(640, 480)); | 3945 webViewHelper.resize(WebSize(640, 480)); |
| 3946 webViewHelper.webView()->setFocus(true); |
| 4024 runPendingTasks(); | 3947 runPendingTasks(); |
| 4025 | 3948 |
| 4026 const char kFindString[] = "result"; | 3949 const char kFindString[] = "result"; |
| 4027 const int kFindIdentifier = 12345; | 3950 const int kFindIdentifier = 12345; |
| 4028 | 3951 |
| 4029 WebFindOptions options; | 3952 WebFindOptions options; |
| 4030 WebString searchText = WebString::fromUTF8(kFindString); | 3953 WebString searchText = WebString::fromUTF8(kFindString); |
| 4031 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3954 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 4032 | 3955 |
| 4033 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3956 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
{ |
| 3957 webViewHelper.webView()->setFocusedFrame(frame); |
| 4034 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); | 3958 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); |
| 3959 } |
| 4035 | 3960 |
| 4036 runPendingTasks(); | 3961 runPendingTasks(); |
| 4037 EXPECT_FALSE(client.findResultsAreReady()); | 3962 EXPECT_FALSE(client.findResultsAreReady()); |
| 4038 | 3963 |
| 4039 mainFrame->resetMatchCount(); | 3964 mainFrame->resetMatchCount(); |
| 4040 | 3965 |
| 4041 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3966 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 4042 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3967 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
| 4043 | 3968 |
| 4044 // The first scopeStringMatches will have reset the state. Detach before it
actually scopes. | 3969 // The first scopeStringMatches will have reset the state. Detach before it
actually scopes. |
| 4045 removeElementById(mainFrame, "frame"); | 3970 removeElementById(mainFrame, "frame"); |
| 4046 | 3971 |
| 4047 runPendingTasks(); | 3972 runPendingTasks(); |
| 4048 EXPECT_TRUE(client.findResultsAreReady()); | 3973 EXPECT_TRUE(client.findResultsAreReady()); |
| 4049 } | 3974 } |
| 4050 | 3975 |
| 4051 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) | 3976 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) |
| 4052 { | 3977 { |
| 4053 registerMockedHttpURLLoad("find_in_generated_frame.html"); | 3978 registerMockedHttpURLLoad("find_in_generated_frame.html"); |
| 4054 | 3979 |
| 4055 FindUpdateWebFrameClient client; | 3980 FindUpdateWebFrameClient client; |
| 4056 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3981 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4057 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html",
true, &client); | 3982 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html",
true, &client); |
| 4058 webViewHelper.resize(WebSize(640, 480)); | 3983 webViewHelper.resize(WebSize(640, 480)); |
| 3984 webViewHelper.webView()->setFocus(true); |
| 4059 runPendingTasks(); | 3985 runPendingTasks(); |
| 4060 | 3986 |
| 4061 const char kFindString[] = "result"; | 3987 const char kFindString[] = "result"; |
| 4062 const int kFindIdentifier = 12345; | 3988 const int kFindIdentifier = 12345; |
| 4063 | 3989 |
| 4064 WebFindOptions options; | 3990 WebFindOptions options; |
| 4065 WebString searchText = WebString::fromUTF8(kFindString); | 3991 WebString searchText = WebString::fromUTF8(kFindString); |
| 4066 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3992 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 4067 | 3993 |
| 4068 // Check that child frame exists. | 3994 // Check that child frame exists. |
| 4069 EXPECT_TRUE(!!mainFrame->traverseNext(false)); | 3995 EXPECT_TRUE(!!mainFrame->traverseNext(false)); |
| 4070 | 3996 |
| 4071 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3997 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 4072 EXPECT_FALSE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); | 3998 EXPECT_FALSE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); |
| 4073 | 3999 |
| 4074 runPendingTasks(); | 4000 runPendingTasks(); |
| 4075 EXPECT_FALSE(client.findResultsAreReady()); | 4001 EXPECT_FALSE(client.findResultsAreReady()); |
| 4076 | 4002 |
| 4077 mainFrame->resetMatchCount(); | 4003 mainFrame->resetMatchCount(); |
| 4078 } | 4004 } |
| 4079 | 4005 |
| 4080 TEST_P(ParameterizedWebFrameTest, SetTickmarks) | 4006 TEST_P(ParameterizedWebFrameTest, SetTickmarks) |
| 4081 { | 4007 { |
| 4082 registerMockedHttpURLLoad("find.html"); | 4008 registerMockedHttpURLLoad("find.html"); |
| 4083 | 4009 |
| 4084 FindUpdateWebFrameClient client; | 4010 FindUpdateWebFrameClient client; |
| 4085 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4011 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4086 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); | 4012 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); |
| 4087 webViewHelper.resize(WebSize(640, 480)); | 4013 webViewHelper.resize(WebSize(640, 480)); |
| 4014 webViewHelper.webView()->setFocus(true); |
| 4088 runPendingTasks(); | 4015 runPendingTasks(); |
| 4089 | 4016 |
| 4090 const char kFindString[] = "foo"; | 4017 const char kFindString[] = "foo"; |
| 4091 const int kFindIdentifier = 12345; | 4018 const int kFindIdentifier = 12345; |
| 4092 | 4019 |
| 4093 WebFindOptions options; | 4020 WebFindOptions options; |
| 4094 WebString searchText = WebString::fromUTF8(kFindString); | 4021 WebString searchText = WebString::fromUTF8(kFindString); |
| 4095 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 4022 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 4096 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 4023 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 4097 | 4024 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4131 } | 4058 } |
| 4132 | 4059 |
| 4133 TEST_P(ParameterizedWebFrameTest, FindInPageJavaScriptUpdatesDOM) | 4060 TEST_P(ParameterizedWebFrameTest, FindInPageJavaScriptUpdatesDOM) |
| 4134 { | 4061 { |
| 4135 registerMockedHttpURLLoad("find.html"); | 4062 registerMockedHttpURLLoad("find.html"); |
| 4136 | 4063 |
| 4137 FindUpdateWebFrameClient client; | 4064 FindUpdateWebFrameClient client; |
| 4138 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4065 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4139 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); | 4066 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); |
| 4140 webViewHelper.resize(WebSize(640, 480)); | 4067 webViewHelper.resize(WebSize(640, 480)); |
| 4068 webViewHelper.webView()->setFocus(true); |
| 4141 runPendingTasks(); | 4069 runPendingTasks(); |
| 4142 | 4070 |
| 4143 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); | 4071 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); |
| 4144 const int findIdentifier = 12345; | 4072 const int findIdentifier = 12345; |
| 4145 static const char* kFindString = "foo"; | 4073 static const char* kFindString = "foo"; |
| 4146 WebString searchText = WebString::fromUTF8(kFindString); | 4074 WebString searchText = WebString::fromUTF8(kFindString); |
| 4147 WebFindOptions options; | 4075 WebFindOptions options; |
| 4148 bool activeNow; | 4076 bool activeNow; |
| 4149 | 4077 |
| 4150 frame->resetMatchCount(); | 4078 frame->resetMatchCount(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4162 "var newTextNode = document.createTextNode('bar5 foo5');" | 4090 "var newTextNode = document.createTextNode('bar5 foo5');" |
| 4163 "var textArea = document.getElementsByTagName('textarea')[0];" | 4091 "var textArea = document.getElementsByTagName('textarea')[0];" |
| 4164 "document.body.insertBefore(newTextNode, textArea);")); | 4092 "document.body.insertBefore(newTextNode, textArea);")); |
| 4165 | 4093 |
| 4166 // Find in a <input> element. | 4094 // Find in a <input> element. |
| 4167 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); | 4095 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4168 EXPECT_TRUE(activeNow); | 4096 EXPECT_TRUE(activeNow); |
| 4169 | 4097 |
| 4170 // Find in the inserted text node. | 4098 // Find in the inserted text node. |
| 4171 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); | 4099 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4172 frame->stopFinding(false); | 4100 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 4173 WebRange range = frame->selectionRange(); | 4101 WebRange range = frame->selectionRange(); |
| 4174 EXPECT_EQ(5, range.startOffset()); | 4102 EXPECT_EQ(5, range.startOffset()); |
| 4175 EXPECT_EQ(8, range.endOffset()); | 4103 EXPECT_EQ(8, range.endOffset()); |
| 4176 EXPECT_TRUE(frame->document().focusedElement().isNull()); | 4104 EXPECT_TRUE(frame->document().focusedElement().isNull()); |
| 4177 EXPECT_FALSE(activeNow); | 4105 EXPECT_FALSE(activeNow); |
| 4178 } | 4106 } |
| 4179 | 4107 |
| 4180 static WebPoint topLeft(const WebRect& rect) | 4108 static WebPoint topLeft(const WebRect& rect) |
| 4181 { | 4109 { |
| 4182 return WebPoint(rect.x, rect.y); | 4110 return WebPoint(rect.x, rect.y); |
| (...skipping 4501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8612 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
| 8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8613 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8614 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
| 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8615 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
| 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8616 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
| 8689 ASSERT_TRUE(result->IsString()); | 8617 ASSERT_TRUE(result->IsString()); |
| 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); | 8618 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); |
| 8691 } | 8619 } |
| 8692 | 8620 |
| 8693 } // namespace blink | 8621 } // namespace blink |
| OLD | NEW |