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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 registerMockedHttpURLLoad("nodeimage.html"); | 250 registerMockedHttpURLLoad("nodeimage.html"); |
251 webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html"); | 251 webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html"); |
252 webViewHelper->webView()->resize(WebSize(640, 480)); | 252 webViewHelper->webView()->resize(WebSize(640, 480)); |
253 webViewHelper->webView()->layout(); | 253 webViewHelper->webView()->layout(); |
254 RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(webViewHelper->webVi
ewImpl()->page()->mainFrame()); | 254 RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(webViewHelper->webVi
ewImpl()->page()->mainFrame()); |
255 ASSERT(frame); | 255 ASSERT(frame); |
256 Element* element = frame->document()->getElementById(testcase.c_str()); | 256 Element* element = frame->document()->getElementById(testcase.c_str()); |
257 return frame->nodeImage(*element); | 257 return frame->nodeImage(*element); |
258 } | 258 } |
259 | 259 |
| 260 void removeElementById(WebLocalFrameImpl* frame, const AtomicString& id) |
| 261 { |
| 262 Element* element = frame->frame()->document()->getElementById(id); |
| 263 ASSERT(element); |
| 264 element->remove(); |
| 265 } |
| 266 |
260 std::string m_baseURL; | 267 std::string m_baseURL; |
261 std::string m_notBaseURL; | 268 std::string m_notBaseURL; |
262 std::string m_chromeURL; | 269 std::string m_chromeURL; |
263 }; | 270 }; |
264 | 271 |
265 enum ParameterizedWebFrameTestConfig { | 272 enum ParameterizedWebFrameTestConfig { |
266 Default, | 273 Default, |
267 RootLayerScrolls | 274 RootLayerScrolls |
268 }; | 275 }; |
269 | 276 |
(...skipping 3647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3917 static const char* kFindString = "result"; | 3924 static const char* kFindString = "result"; |
3918 static const int kFindIdentifier = 12345; | 3925 static const int kFindIdentifier = 12345; |
3919 | 3926 |
3920 WebFindOptions options; | 3927 WebFindOptions options; |
3921 WebString searchText = WebString::fromUTF8(kFindString); | 3928 WebString searchText = WebString::fromUTF8(kFindString); |
3922 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 3929 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
3923 RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(main
Frame->traverseNext(false)); | 3930 RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(main
Frame->traverseNext(false)); |
3924 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3931 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
3925 | 3932 |
3926 // Detach the frame before finding. | 3933 // Detach the frame before finding. |
3927 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); | 3934 removeElementById(mainFrame, "frame"); |
3928 | 3935 |
3929 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; | 3936 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0))
; |
3930 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false,
0)); | 3937 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false,
0)); |
3931 | 3938 |
3932 runPendingTasks(); | 3939 runPendingTasks(); |
3933 EXPECT_FALSE(client.findResultsAreReady()); | 3940 EXPECT_FALSE(client.findResultsAreReady()); |
3934 | 3941 |
3935 mainFrame->resetMatchCount(); | 3942 mainFrame->resetMatchCount(); |
3936 | 3943 |
3937 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3944 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
(...skipping 24 matching lines...) Expand all Loading... |
3962 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); | 3969 WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext
(false)); |
3963 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); | 3970 RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
3964 | 3971 |
3965 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3972 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3966 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; | 3973 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0))
; |
3967 | 3974 |
3968 runPendingTasks(); | 3975 runPendingTasks(); |
3969 EXPECT_FALSE(client.findResultsAreReady()); | 3976 EXPECT_FALSE(client.findResultsAreReady()); |
3970 | 3977 |
3971 // Detach the frame between finding and scoping. | 3978 // Detach the frame between finding and scoping. |
3972 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); | 3979 removeElementById(mainFrame, "frame"); |
3973 | 3980 |
3974 mainFrame->resetMatchCount(); | 3981 mainFrame->resetMatchCount(); |
3975 | 3982 |
3976 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 3983 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
3977 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 3984 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
3978 | 3985 |
3979 runPendingTasks(); | 3986 runPendingTasks(); |
3980 EXPECT_TRUE(client.findResultsAreReady()); | 3987 EXPECT_TRUE(client.findResultsAreReady()); |
3981 } | 3988 } |
3982 | 3989 |
(...skipping 23 matching lines...) Expand all Loading... |
4006 | 4013 |
4007 runPendingTasks(); | 4014 runPendingTasks(); |
4008 EXPECT_FALSE(client.findResultsAreReady()); | 4015 EXPECT_FALSE(client.findResultsAreReady()); |
4009 | 4016 |
4010 mainFrame->resetMatchCount(); | 4017 mainFrame->resetMatchCount(); |
4011 | 4018 |
4012 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) | 4019 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
4013 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); | 4020 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
4014 | 4021 |
4015 // The first scopeStringMatches will have reset the state. Detach before it
actually scopes. | 4022 // The first scopeStringMatches will have reset the state. Detach before it
actually scopes. |
4016 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); | 4023 removeElementById(mainFrame, "frame"); |
4017 | 4024 |
4018 runPendingTasks(); | 4025 runPendingTasks(); |
4019 EXPECT_TRUE(client.findResultsAreReady()); | 4026 EXPECT_TRUE(client.findResultsAreReady()); |
4020 } | 4027 } |
4021 | 4028 |
4022 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) | 4029 TEST_P(ParameterizedWebFrameTest, ResetMatchCount) |
4023 { | 4030 { |
4024 registerMockedHttpURLLoad("find_in_generated_frame.html"); | 4031 registerMockedHttpURLLoad("find_in_generated_frame.html"); |
4025 | 4032 |
4026 FindUpdateWebFrameClient client; | 4033 FindUpdateWebFrameClient client; |
(...skipping 4175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8202 | 8209 |
8203 TEST_F(WebFrameTest, MaxFramesDetach) | 8210 TEST_F(WebFrameTest, MaxFramesDetach) |
8204 { | 8211 { |
8205 registerMockedHttpURLLoad("max-frames-detach.html"); | 8212 registerMockedHttpURLLoad("max-frames-detach.html"); |
8206 FrameTestHelpers::WebViewHelper webViewHelper; | 8213 FrameTestHelpers::WebViewHelper webViewHelper; |
8207 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 8214 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
8208 webViewImpl->mainFrameImpl()->collectGarbage(); | 8215 webViewImpl->mainFrameImpl()->collectGarbage(); |
8209 } | 8216 } |
8210 | 8217 |
8211 } // namespace blink | 8218 } // namespace blink |
OLD | NEW |