| 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 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3739 | 3739 |
| 3740 FindUpdateWebFrameClient client; | 3740 FindUpdateWebFrameClient client; |
| 3741 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3741 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3742 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3742 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 3743 webViewHelper.resize(WebSize(640, 480)); | 3743 webViewHelper.resize(WebSize(640, 480)); |
| 3744 webViewHelper.webView()->setMaximumLegibleScale(1.f); | 3744 webViewHelper.webView()->setMaximumLegibleScale(1.f); |
| 3745 webViewHelper.webView()->updateAllLifecyclePhases(); | 3745 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 3746 runPendingTasks(); | 3746 runPendingTasks(); |
| 3747 | 3747 |
| 3748 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. | 3748 // Note that the 'result 19' in the <select> element is not expected to prod
uce a match. |
| 3749 static const char* kFindString = "result"; | 3749 const char kFindString[] = "result"; |
| 3750 static const int kFindIdentifier = 12345; | 3750 const int kFindIdentifier = 12345; |
| 3751 static const int kNumResults = 19; | 3751 const int kNumResults = 19; |
| 3752 | 3752 |
| 3753 WebFindOptions options; | 3753 WebFindOptions options; |
| 3754 WebString searchText = WebString::fromUTF8(kFindString); | 3754 WebString searchText = WebString::fromUTF8(kFindString); |
| 3755 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3755 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3756 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3756 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3757 | 3757 |
| 3758 mainFrame->resetMatchCount(); | 3758 mainFrame->resetMatchCount(); |
| 3759 | 3759 |
| 3760 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3760 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3761 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 3761 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3855 TEST_P(ParameterizedWebFrameTest, FindInPageSkipsHiddenFrames) | 3855 TEST_P(ParameterizedWebFrameTest, FindInPageSkipsHiddenFrames) |
| 3856 { | 3856 { |
| 3857 registerMockedHttpURLLoad("find_in_hidden_frame.html"); | 3857 registerMockedHttpURLLoad("find_in_hidden_frame.html"); |
| 3858 | 3858 |
| 3859 FindUpdateWebFrameClient client; | 3859 FindUpdateWebFrameClient client; |
| 3860 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3860 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3861 webViewHelper.initializeAndLoad(m_baseURL + "find_in_hidden_frame.html", tru
e, &client); | 3861 webViewHelper.initializeAndLoad(m_baseURL + "find_in_hidden_frame.html", tru
e, &client); |
| 3862 webViewHelper.resize(WebSize(640, 480)); | 3862 webViewHelper.resize(WebSize(640, 480)); |
| 3863 runPendingTasks(); | 3863 runPendingTasks(); |
| 3864 | 3864 |
| 3865 static const char* kFindString = "hello"; | 3865 const char kFindString[] = "hello"; |
| 3866 static const int kFindIdentifier = 12345; | 3866 const int kFindIdentifier = 12345; |
| 3867 static const int kNumResults = 1; | 3867 const int kNumResults = 1; |
| 3868 | 3868 |
| 3869 WebFindOptions options; | 3869 WebFindOptions options; |
| 3870 WebString searchText = WebString::fromUTF8(kFindString); | 3870 WebString searchText = WebString::fromUTF8(kFindString); |
| 3871 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3871 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3872 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3872 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3873 | 3873 |
| 3874 mainFrame->resetMatchCount(); | 3874 mainFrame->resetMatchCount(); |
| 3875 | 3875 |
| 3876 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3876 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3877 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 3877 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
| 3878 | 3878 |
| 3879 runPendingTasks(); | 3879 runPendingTasks(); |
| 3880 EXPECT_TRUE(client.findResultsAreReady()); | 3880 EXPECT_TRUE(client.findResultsAreReady()); |
| 3881 EXPECT_EQ(kNumResults, client.count()); | 3881 EXPECT_EQ(kNumResults, client.count()); |
| 3882 } | 3882 } |
| 3883 | 3883 |
| 3884 TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) | 3884 TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) |
| 3885 { | 3885 { |
| 3886 registerMockedHttpURLLoad("find_in_page.html"); | 3886 registerMockedHttpURLLoad("find_in_page.html"); |
| 3887 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3887 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 3888 | 3888 |
| 3889 FindUpdateWebFrameClient client; | 3889 FindUpdateWebFrameClient client; |
| 3890 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3890 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3891 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3891 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 3892 webViewHelper.resize(WebSize(640, 480)); | 3892 webViewHelper.resize(WebSize(640, 480)); |
| 3893 runPendingTasks(); | 3893 runPendingTasks(); |
| 3894 | 3894 |
| 3895 static const char* kFindString = "result"; | 3895 const char kFindString[] = "result"; |
| 3896 static const int kFindIdentifier = 12345; | 3896 const int kFindIdentifier = 12345; |
| 3897 | 3897 |
| 3898 WebFindOptions options; | 3898 WebFindOptions options; |
| 3899 WebString searchText = WebString::fromUTF8(kFindString); | 3899 WebString searchText = WebString::fromUTF8(kFindString); |
| 3900 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3900 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3901 RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(main
Frame->traverseNext(false)); | 3901 RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(main
Frame->traverseNext(false)); |
| 3902 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3902 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
| 3903 | 3903 |
| 3904 // Detach the frame before finding. | 3904 // Detach the frame before finding. |
| 3905 removeElementById(mainFrame, "frame"); | 3905 removeElementById(mainFrame, "frame"); |
| 3906 | 3906 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3923 { | 3923 { |
| 3924 registerMockedHttpURLLoad("find_in_page.html"); | 3924 registerMockedHttpURLLoad("find_in_page.html"); |
| 3925 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3925 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 3926 | 3926 |
| 3927 FindUpdateWebFrameClient client; | 3927 FindUpdateWebFrameClient client; |
| 3928 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3928 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3929 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3929 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 3930 webViewHelper.resize(WebSize(640, 480)); | 3930 webViewHelper.resize(WebSize(640, 480)); |
| 3931 runPendingTasks(); | 3931 runPendingTasks(); |
| 3932 | 3932 |
| 3933 static const char* kFindString = "result"; | 3933 const char kFindString[] = "result"; |
| 3934 static const int kFindIdentifier = 12345; | 3934 const int kFindIdentifier = 12345; |
| 3935 | 3935 |
| 3936 WebFindOptions options; | 3936 WebFindOptions options; |
| 3937 WebString searchText = WebString::fromUTF8(kFindString); | 3937 WebString searchText = WebString::fromUTF8(kFindString); |
| 3938 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3938 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3939 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); | 3939 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); |
| 3940 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3940 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
| 3941 | 3941 |
| 3942 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3942 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3943 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; | 3943 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3944 | 3944 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3961 { | 3961 { |
| 3962 registerMockedHttpURLLoad("find_in_page.html"); | 3962 registerMockedHttpURLLoad("find_in_page.html"); |
| 3963 registerMockedHttpURLLoad("find_in_page_frame.html"); | 3963 registerMockedHttpURLLoad("find_in_page_frame.html"); |
| 3964 | 3964 |
| 3965 FindUpdateWebFrameClient client; | 3965 FindUpdateWebFrameClient client; |
| 3966 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3966 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3967 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); | 3967 webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &clie
nt); |
| 3968 webViewHelper.resize(WebSize(640, 480)); | 3968 webViewHelper.resize(WebSize(640, 480)); |
| 3969 runPendingTasks(); | 3969 runPendingTasks(); |
| 3970 | 3970 |
| 3971 static const char* kFindString = "result"; | 3971 const char kFindString[] = "result"; |
| 3972 static const int kFindIdentifier = 12345; | 3972 const int kFindIdentifier = 12345; |
| 3973 | 3973 |
| 3974 WebFindOptions options; | 3974 WebFindOptions options; |
| 3975 WebString searchText = WebString::fromUTF8(kFindString); | 3975 WebString searchText = WebString::fromUTF8(kFindString); |
| 3976 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3976 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 3977 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); | 3977 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); |
| 3978 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3978 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
| 3979 | 3979 |
| 3980 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3980 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
| 3981 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; | 3981 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 3982 | 3982 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3998 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) | 3998 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) |
| 3999 { | 3999 { |
| 4000 registerMockedHttpURLLoad("find_in_generated_frame.html"); | 4000 registerMockedHttpURLLoad("find_in_generated_frame.html"); |
| 4001 | 4001 |
| 4002 FindUpdateWebFrameClient client; | 4002 FindUpdateWebFrameClient client; |
| 4003 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4003 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4004 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html",
true, &client); | 4004 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html",
true, &client); |
| 4005 webViewHelper.resize(WebSize(640, 480)); | 4005 webViewHelper.resize(WebSize(640, 480)); |
| 4006 runPendingTasks(); | 4006 runPendingTasks(); |
| 4007 | 4007 |
| 4008 static const char* kFindString = "result"; | 4008 const char kFindString[] = "result"; |
| 4009 static const int kFindIdentifier = 12345; | 4009 const int kFindIdentifier = 12345; |
| 4010 | 4010 |
| 4011 WebFindOptions options; | 4011 WebFindOptions options; |
| 4012 WebString searchText = WebString::fromUTF8(kFindString); | 4012 WebString searchText = WebString::fromUTF8(kFindString); |
| 4013 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 4013 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 4014 | 4014 |
| 4015 // Check that child frame exists. | 4015 // Check that child frame exists. |
| 4016 EXPECT_TRUE(!!mainFrame->traverseNext(false)); | 4016 EXPECT_TRUE(!!mainFrame->traverseNext(false)); |
| 4017 | 4017 |
| 4018 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
{ | 4018 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
{ |
| 4019 EXPECT_FALSE(frame->find(kFindIdentifier, searchText, options, false, 0)
); | 4019 EXPECT_FALSE(frame->find(kFindIdentifier, searchText, options, false, 0)
); |
| 4020 } | 4020 } |
| 4021 | 4021 |
| 4022 runPendingTasks(); | 4022 runPendingTasks(); |
| 4023 EXPECT_FALSE(client.findResultsAreReady()); | 4023 EXPECT_FALSE(client.findResultsAreReady()); |
| 4024 | 4024 |
| 4025 mainFrame->resetMatchCount(); | 4025 mainFrame->resetMatchCount(); |
| 4026 } | 4026 } |
| 4027 | 4027 |
| 4028 TEST_P(ParameterizedWebFrameTest, SetTickmarks) | 4028 TEST_P(ParameterizedWebFrameTest, SetTickmarks) |
| 4029 { | 4029 { |
| 4030 registerMockedHttpURLLoad("find.html"); | 4030 registerMockedHttpURLLoad("find.html"); |
| 4031 | 4031 |
| 4032 FindUpdateWebFrameClient client; | 4032 FindUpdateWebFrameClient client; |
| 4033 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4033 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4034 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); | 4034 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); |
| 4035 webViewHelper.resize(WebSize(640, 480)); | 4035 webViewHelper.resize(WebSize(640, 480)); |
| 4036 runPendingTasks(); | 4036 runPendingTasks(); |
| 4037 | 4037 |
| 4038 static const char* kFindString = "foo"; | 4038 const char kFindString[] = "foo"; |
| 4039 static const int kFindIdentifier = 12345; | 4039 const int kFindIdentifier = 12345; |
| 4040 | 4040 |
| 4041 WebFindOptions options; | 4041 WebFindOptions options; |
| 4042 WebString searchText = WebString::fromUTF8(kFindString); | 4042 WebString searchText = WebString::fromUTF8(kFindString); |
| 4043 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 4043 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 4044 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 4044 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
| 4045 | 4045 |
| 4046 mainFrame->resetMatchCount(); | 4046 mainFrame->resetMatchCount(); |
| 4047 mainFrame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 4047 mainFrame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
| 4048 | 4048 |
| 4049 runPendingTasks(); | 4049 runPendingTasks(); |
| (...skipping 4355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8405 } | 8405 } |
| 8406 | 8406 |
| 8407 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8407 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
| 8408 { | 8408 { |
| 8409 swapLocalFrameToRemoteFrame(); | 8409 swapLocalFrameToRemoteFrame(); |
| 8410 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8410 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
| 8411 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8411 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
| 8412 } | 8412 } |
| 8413 | 8413 |
| 8414 } // namespace blink | 8414 } // namespace blink |
| OLD | NEW |