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 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); | 3567 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); |
3568 const int findIdentifier = 12345; | 3568 const int findIdentifier = 12345; |
3569 WebFindOptions options; | 3569 WebFindOptions options; |
3570 | 3570 |
3571 // Find in a <div> element. | 3571 // Find in a <div> element. |
3572 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar1"), options
, false, 0)); | 3572 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar1"), options
, false, 0, nullptr)); |
3573 frame->stopFinding(false); | 3573 frame->stopFinding(false); |
3574 WebRange range = frame->selectionRange(); | 3574 WebRange range = frame->selectionRange(); |
3575 EXPECT_EQ(5, range.startOffset()); | 3575 EXPECT_EQ(5, range.startOffset()); |
3576 EXPECT_EQ(9, range.endOffset()); | 3576 EXPECT_EQ(9, range.endOffset()); |
3577 EXPECT_TRUE(frame->document().focusedElement().isNull()); | 3577 EXPECT_TRUE(frame->document().focusedElement().isNull()); |
3578 | 3578 |
3579 // Find in an <input> value. | 3579 // Find in an <input> value. |
3580 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar2"), options
, false, 0)); | 3580 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar2"), options
, false, 0, nullptr)); |
3581 // Confirm stopFinding(false) sets the selection on the found text. | 3581 // Confirm stopFinding(false) sets the selection on the found text. |
3582 frame->stopFinding(false); | 3582 frame->stopFinding(false); |
3583 range = frame->selectionRange(); | 3583 range = frame->selectionRange(); |
3584 ASSERT_FALSE(range.isNull()); | 3584 ASSERT_FALSE(range.isNull()); |
3585 EXPECT_EQ(5, range.startOffset()); | 3585 EXPECT_EQ(5, range.startOffset()); |
3586 EXPECT_EQ(9, range.endOffset()); | 3586 EXPECT_EQ(9, range.endOffset()); |
3587 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("input")); | 3587 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("input")); |
3588 | 3588 |
3589 // Find in a <textarea> content. | 3589 // Find in a <textarea> content. |
3590 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar3"), options
, false, 0)); | 3590 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar3"), options
, false, 0, nullptr)); |
3591 // Confirm stopFinding(false) sets the selection on the found text. | 3591 // Confirm stopFinding(false) sets the selection on the found text. |
3592 frame->stopFinding(false); | 3592 frame->stopFinding(false); |
3593 range = frame->selectionRange(); | 3593 range = frame->selectionRange(); |
3594 ASSERT_FALSE(range.isNull()); | 3594 ASSERT_FALSE(range.isNull()); |
3595 EXPECT_EQ(5, range.startOffset()); | 3595 EXPECT_EQ(5, range.startOffset()); |
3596 EXPECT_EQ(9, range.endOffset()); | 3596 EXPECT_EQ(9, range.endOffset()); |
3597 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("textarea")); | 3597 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("textarea")); |
3598 | 3598 |
3599 // Find in a contentEditable element. | 3599 // Find in a contentEditable element. |
3600 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar4"), options
, false, 0)); | 3600 EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar4"), options
, false, 0, nullptr)); |
3601 // Confirm stopFinding(false) sets the selection on the found text. | 3601 // Confirm stopFinding(false) sets the selection on the found text. |
3602 frame->stopFinding(false); | 3602 frame->stopFinding(false); |
3603 range = frame->selectionRange(); | 3603 range = frame->selectionRange(); |
3604 ASSERT_FALSE(range.isNull()); | 3604 ASSERT_FALSE(range.isNull()); |
3605 EXPECT_EQ(0, range.startOffset()); | 3605 EXPECT_EQ(0, range.startOffset()); |
3606 EXPECT_EQ(4, range.endOffset()); | 3606 EXPECT_EQ(4, range.endOffset()); |
3607 // "bar4" is surrounded by <span>, but the focusable node should be the pare
nt <div>. | 3607 // "bar4" is surrounded by <span>, but the focusable node should be the pare
nt <div>. |
3608 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("div")); | 3608 EXPECT_TRUE(frame->document().focusedElement().hasHTMLTagName("div")); |
3609 | 3609 |
3610 // Find in <select> content. | 3610 // Find in <select> content. |
3611 EXPECT_FALSE(frame->find(findIdentifier, WebString::fromUTF8("bar5"), option
s, false, 0)); | 3611 EXPECT_FALSE(frame->find(findIdentifier, WebString::fromUTF8("bar5"), option
s, false, 0, nullptr)); |
3612 // If there are any matches, stopFinding will set the selection on the found
text. | 3612 // 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. | 3613 // However, we do not expect any matches, so check that the selection is nul
l. |
3614 frame->stopFinding(false); | 3614 frame->stopFinding(false); |
3615 range = frame->selectionRange(); | 3615 range = frame->selectionRange(); |
3616 ASSERT_TRUE(range.isNull()); | 3616 ASSERT_TRUE(range.isNull()); |
3617 } | 3617 } |
3618 | 3618 |
3619 TEST_P(ParameterizedWebFrameTest, GetContentAsPlainText) | 3619 TEST_P(ParameterizedWebFrameTest, GetContentAsPlainText) |
3620 { | 3620 { |
3621 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3621 FrameTestHelpers::WebViewHelper webViewHelper(this); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3748 runPendingTasks(); | 3748 runPendingTasks(); |
3749 | 3749 |
3750 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. | 3750 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. |
3751 const char kFindString[] = "result"; | 3751 const char kFindString[] = "result"; |
3752 const int kFindIdentifier = 12345; | 3752 const int kFindIdentifier = 12345; |
3753 const int kNumResults = 19; | 3753 const int kNumResults = 19; |
3754 | 3754 |
3755 WebFindOptions options; | 3755 WebFindOptions options; |
3756 WebString searchText = WebString::fromUTF8(kFindString); | 3756 WebString searchText = WebString::fromUTF8(kFindString); |
3757 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3757 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
3758 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3758 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0,
nullptr)); |
3759 | 3759 |
3760 mainFrame->resetMatchCount(); | 3760 mainFrame->resetMatchCount(); |
3761 | 3761 |
3762 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3762 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3763 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3763 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
3764 | 3764 |
3765 runPendingTasks(); | 3765 runPendingTasks(); |
3766 EXPECT_TRUE(client.findResultsAreReady()); | 3766 EXPECT_TRUE(client.findResultsAreReady()); |
3767 | 3767 |
3768 WebVector<WebFloatRect> webMatchRects; | 3768 WebVector<WebFloatRect> webMatchRects; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3864 webViewHelper.resize(WebSize(640, 480)); | 3864 webViewHelper.resize(WebSize(640, 480)); |
3865 runPendingTasks(); | 3865 runPendingTasks(); |
3866 | 3866 |
3867 const char kFindString[] = "hello"; | 3867 const char kFindString[] = "hello"; |
3868 const int kFindIdentifier = 12345; | 3868 const int kFindIdentifier = 12345; |
3869 const int kNumResults = 1; | 3869 const int kNumResults = 1; |
3870 | 3870 |
3871 WebFindOptions options; | 3871 WebFindOptions options; |
3872 WebString searchText = WebString::fromUTF8(kFindString); | 3872 WebString searchText = WebString::fromUTF8(kFindString); |
3873 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3873 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
3874 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3874 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0,
nullptr)); |
3875 | 3875 |
3876 mainFrame->resetMatchCount(); | 3876 mainFrame->resetMatchCount(); |
3877 | 3877 |
3878 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3878 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3879 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3879 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
3880 | 3880 |
3881 runPendingTasks(); | 3881 runPendingTasks(); |
3882 EXPECT_TRUE(client.findResultsAreReady()); | 3882 EXPECT_TRUE(client.findResultsAreReady()); |
3883 EXPECT_EQ(kNumResults, client.count()); | 3883 EXPECT_EQ(kNumResults, client.count()); |
3884 } | 3884 } |
(...skipping 14 matching lines...) Expand all Loading... |
3899 | 3899 |
3900 WebFindOptions options; | 3900 WebFindOptions options; |
3901 WebString searchText = WebString::fromUTF8(kFindString); | 3901 WebString searchText = WebString::fromUTF8(kFindString); |
3902 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3902 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
3903 RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(main
Frame->traverseNext(false)); | 3903 RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(main
Frame->traverseNext(false)); |
3904 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3904 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
3905 | 3905 |
3906 // Detach the frame before finding. | 3906 // Detach the frame before finding. |
3907 removeElementById(mainFrame, "frame"); | 3907 removeElementById(mainFrame, "frame"); |
3908 | 3908 |
3909 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3909 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0,
nullptr)); |
3910 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false,
0)); | 3910 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false,
0, nullptr)); |
3911 | 3911 |
3912 runPendingTasks(); | 3912 runPendingTasks(); |
3913 EXPECT_FALSE(client.findResultsAreReady()); | 3913 EXPECT_FALSE(client.findResultsAreReady()); |
3914 | 3914 |
3915 mainFrame->resetMatchCount(); | 3915 mainFrame->resetMatchCount(); |
3916 | 3916 |
3917 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3917 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3918 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3918 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
3919 | 3919 |
3920 runPendingTasks(); | 3920 runPendingTasks(); |
(...skipping 14 matching lines...) Expand all Loading... |
3935 const char kFindString[] = "result"; | 3935 const char kFindString[] = "result"; |
3936 const int kFindIdentifier = 12345; | 3936 const int kFindIdentifier = 12345; |
3937 | 3937 |
3938 WebFindOptions options; | 3938 WebFindOptions options; |
3939 WebString searchText = WebString::fromUTF8(kFindString); | 3939 WebString searchText = WebString::fromUTF8(kFindString); |
3940 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3940 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
3941 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); | 3941 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); |
3942 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3942 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
3943 | 3943 |
3944 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3944 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3945 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); | 3945 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0, nullptr)); |
3946 | 3946 |
3947 runPendingTasks(); | 3947 runPendingTasks(); |
3948 EXPECT_FALSE(client.findResultsAreReady()); | 3948 EXPECT_FALSE(client.findResultsAreReady()); |
3949 | 3949 |
3950 // Detach the frame between finding and scoping. | 3950 // Detach the frame between finding and scoping. |
3951 removeElementById(mainFrame, "frame"); | 3951 removeElementById(mainFrame, "frame"); |
3952 | 3952 |
3953 mainFrame->resetMatchCount(); | 3953 mainFrame->resetMatchCount(); |
3954 | 3954 |
3955 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3955 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
(...skipping 17 matching lines...) Expand all Loading... |
3973 const char kFindString[] = "result"; | 3973 const char kFindString[] = "result"; |
3974 const int kFindIdentifier = 12345; | 3974 const int kFindIdentifier = 12345; |
3975 | 3975 |
3976 WebFindOptions options; | 3976 WebFindOptions options; |
3977 WebString searchText = WebString::fromUTF8(kFindString); | 3977 WebString searchText = WebString::fromUTF8(kFindString); |
3978 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3978 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
3979 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); | 3979 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); |
3980 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3980 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
3981 | 3981 |
3982 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3982 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3983 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); | 3983 EXPECT_TRUE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0, nullptr)); |
3984 | 3984 |
3985 runPendingTasks(); | 3985 runPendingTasks(); |
3986 EXPECT_FALSE(client.findResultsAreReady()); | 3986 EXPECT_FALSE(client.findResultsAreReady()); |
3987 | 3987 |
3988 mainFrame->resetMatchCount(); | 3988 mainFrame->resetMatchCount(); |
3989 | 3989 |
3990 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3990 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3991 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); | 3991 frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText
, options, true); |
3992 | 3992 |
3993 // The first scopeStringMatches will have reset the state. Detach before it
actually scopes. | 3993 // The first scopeStringMatches will have reset the state. Detach before it
actually scopes. |
(...skipping 17 matching lines...) Expand all Loading... |
4011 const int kFindIdentifier = 12345; | 4011 const int kFindIdentifier = 12345; |
4012 | 4012 |
4013 WebFindOptions options; | 4013 WebFindOptions options; |
4014 WebString searchText = WebString::fromUTF8(kFindString); | 4014 WebString searchText = WebString::fromUTF8(kFindString); |
4015 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 4015 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
4016 | 4016 |
4017 // Check that child frame exists. | 4017 // Check that child frame exists. |
4018 EXPECT_TRUE(!!mainFrame->traverseNext(false)); | 4018 EXPECT_TRUE(!!mainFrame->traverseNext(false)); |
4019 | 4019 |
4020 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 4020 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
4021 EXPECT_FALSE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0)); | 4021 EXPECT_FALSE(frame->toWebLocalFrame()->find(kFindIdentifier, searchText,
options, false, 0, nullptr)); |
4022 | 4022 |
4023 runPendingTasks(); | 4023 runPendingTasks(); |
4024 EXPECT_FALSE(client.findResultsAreReady()); | 4024 EXPECT_FALSE(client.findResultsAreReady()); |
4025 | 4025 |
4026 mainFrame->resetMatchCount(); | 4026 mainFrame->resetMatchCount(); |
4027 } | 4027 } |
4028 | 4028 |
4029 TEST_P(ParameterizedWebFrameTest, SetTickmarks) | 4029 TEST_P(ParameterizedWebFrameTest, SetTickmarks) |
4030 { | 4030 { |
4031 registerMockedHttpURLLoad("find.html"); | 4031 registerMockedHttpURLLoad("find.html"); |
4032 | 4032 |
4033 FindUpdateWebFrameClient client; | 4033 FindUpdateWebFrameClient client; |
4034 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4034 FrameTestHelpers::WebViewHelper webViewHelper(this); |
4035 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); | 4035 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); |
4036 webViewHelper.resize(WebSize(640, 480)); | 4036 webViewHelper.resize(WebSize(640, 480)); |
4037 runPendingTasks(); | 4037 runPendingTasks(); |
4038 | 4038 |
4039 const char kFindString[] = "foo"; | 4039 const char kFindString[] = "foo"; |
4040 const int kFindIdentifier = 12345; | 4040 const int kFindIdentifier = 12345; |
4041 | 4041 |
4042 WebFindOptions options; | 4042 WebFindOptions options; |
4043 WebString searchText = WebString::fromUTF8(kFindString); | 4043 WebString searchText = WebString::fromUTF8(kFindString); |
4044 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 4044 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
4045 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 4045 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0,
nullptr)); |
4046 | 4046 |
4047 mainFrame->resetMatchCount(); | 4047 mainFrame->resetMatchCount(); |
4048 mainFrame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 4048 mainFrame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
4049 | 4049 |
4050 runPendingTasks(); | 4050 runPendingTasks(); |
4051 EXPECT_TRUE(client.findResultsAreReady()); | 4051 EXPECT_TRUE(client.findResultsAreReady()); |
4052 | 4052 |
4053 // Get the tickmarks for the original find request. | 4053 // Get the tickmarks for the original find request. |
4054 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 4054 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
4055 RefPtrWillBeRawPtr<Scrollbar> scrollbar = frameView->createScrollbar(Horizon
talScrollbar); | 4055 RefPtrWillBeRawPtr<Scrollbar> scrollbar = frameView->createScrollbar(Horizon
talScrollbar); |
(...skipping 16 matching lines...) Expand all Loading... |
4072 // Reset the tickmark behavior. | 4072 // Reset the tickmark behavior. |
4073 Vector<IntRect> resetTickmarks; | 4073 Vector<IntRect> resetTickmarks; |
4074 mainFrame->setTickmarks(resetTickmarks); | 4074 mainFrame->setTickmarks(resetTickmarks); |
4075 | 4075 |
4076 // Check that the original tickmarks are returned | 4076 // Check that the original tickmarks are returned |
4077 Vector<IntRect> originalTickmarksAfterReset; | 4077 Vector<IntRect> originalTickmarksAfterReset; |
4078 scrollbar->getTickmarks(originalTickmarksAfterReset); | 4078 scrollbar->getTickmarks(originalTickmarksAfterReset); |
4079 EXPECT_EQ(originalTickmarks, originalTickmarksAfterReset); | 4079 EXPECT_EQ(originalTickmarks, originalTickmarksAfterReset); |
4080 } | 4080 } |
4081 | 4081 |
| 4082 TEST_P(ParameterizedWebFrameTest, FindInPageJavaScriptUpdatesDOM) |
| 4083 { |
| 4084 registerMockedHttpURLLoad("find.html"); |
| 4085 |
| 4086 FindUpdateWebFrameClient client; |
| 4087 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4088 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); |
| 4089 webViewHelper.resize(WebSize(640, 480)); |
| 4090 runPendingTasks(); |
| 4091 |
| 4092 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); |
| 4093 const int findIdentifier = 12345; |
| 4094 static const char* kFindString = "foo"; |
| 4095 WebString searchText = WebString::fromUTF8(kFindString); |
| 4096 WebFindOptions options; |
| 4097 bool activeNow; |
| 4098 |
| 4099 frame->resetMatchCount(); |
| 4100 frame->scopeStringMatches(findIdentifier, searchText, options, true); |
| 4101 runPendingTasks(); |
| 4102 EXPECT_TRUE(client.findResultsAreReady()); |
| 4103 |
| 4104 // Find in a <div> element. |
| 4105 options.findNext = true; |
| 4106 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4107 EXPECT_TRUE(activeNow); |
| 4108 |
| 4109 // Insert new text, which contains occurence of |searchText|. |
| 4110 frame->executeScript(WebScriptSource( |
| 4111 "var newTextNode = document.createTextNode('bar5 foo5');" |
| 4112 "var textArea = document.getElementsByTagName('textarea')[0];" |
| 4113 "document.body.insertBefore(newTextNode, textArea);")); |
| 4114 |
| 4115 // Find in a <input> element. |
| 4116 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4117 EXPECT_TRUE(activeNow); |
| 4118 |
| 4119 // Find in the inserted text node. |
| 4120 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4121 frame->stopFinding(false); |
| 4122 WebRange range = frame->selectionRange(); |
| 4123 EXPECT_EQ(5, range.startOffset()); |
| 4124 EXPECT_EQ(8, range.endOffset()); |
| 4125 EXPECT_TRUE(frame->document().focusedElement().isNull()); |
| 4126 EXPECT_FALSE(activeNow); |
| 4127 } |
| 4128 |
4082 static WebPoint topLeft(const WebRect& rect) | 4129 static WebPoint topLeft(const WebRect& rect) |
4083 { | 4130 { |
4084 return WebPoint(rect.x, rect.y); | 4131 return WebPoint(rect.x, rect.y); |
4085 } | 4132 } |
4086 | 4133 |
4087 static WebPoint bottomRightMinusOne(const WebRect& rect) | 4134 static WebPoint bottomRightMinusOne(const WebRect& rect) |
4088 { | 4135 { |
4089 // FIXME: If we don't subtract 1 from the x- and y-coordinates of the | 4136 // FIXME: If we don't subtract 1 from the x- and y-coordinates of the |
4090 // selection bounds, selectRange() will select the *next* element. That's | 4137 // selection bounds, selectRange() will select the *next* element. That's |
4091 // strictly correct, as hit-testing checks the pixel to the lower-right of | 4138 // strictly correct, as hit-testing checks the pixel to the lower-right of |
(...skipping 4315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8407 } | 8454 } |
8408 | 8455 |
8409 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8456 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
8410 { | 8457 { |
8411 swapLocalFrameToRemoteFrame(); | 8458 swapLocalFrameToRemoteFrame(); |
8412 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8459 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
8413 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8460 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
8414 } | 8461 } |
8415 | 8462 |
8416 } // namespace blink | 8463 } // namespace blink |
OLD | NEW |