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 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 // Reset the tickmark behavior. | 4105 // Reset the tickmark behavior. |
4106 Vector<IntRect> resetTickmarks; | 4106 Vector<IntRect> resetTickmarks; |
4107 mainFrame->setTickmarks(resetTickmarks); | 4107 mainFrame->setTickmarks(resetTickmarks); |
4108 | 4108 |
4109 // Check that the original tickmarks are returned | 4109 // Check that the original tickmarks are returned |
4110 Vector<IntRect> originalTickmarksAfterReset; | 4110 Vector<IntRect> originalTickmarksAfterReset; |
4111 scrollbar->getTickmarks(originalTickmarksAfterReset); | 4111 scrollbar->getTickmarks(originalTickmarksAfterReset); |
4112 EXPECT_EQ(originalTickmarks, originalTickmarksAfterReset); | 4112 EXPECT_EQ(originalTickmarks, originalTickmarksAfterReset); |
4113 } | 4113 } |
4114 | 4114 |
| 4115 TEST_P(ParameterizedWebFrameTest, FindInPageJavaScriptUpdatesDOM) |
| 4116 { |
| 4117 registerMockedHttpURLLoad("find.html"); |
| 4118 |
| 4119 FindUpdateWebFrameClient client; |
| 4120 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4121 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); |
| 4122 webViewHelper.resize(WebSize(640, 480)); |
| 4123 runPendingTasks(); |
| 4124 |
| 4125 WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame
(); |
| 4126 const int findIdentifier = 12345; |
| 4127 static const char* kFindString = "foo"; |
| 4128 WebString searchText = WebString::fromUTF8(kFindString); |
| 4129 WebFindOptions options; |
| 4130 bool activeNow; |
| 4131 |
| 4132 frame->resetMatchCount(); |
| 4133 frame->scopeStringMatches(findIdentifier, searchText, options, true); |
| 4134 runPendingTasks(); |
| 4135 EXPECT_TRUE(client.findResultsAreReady()); |
| 4136 |
| 4137 // Find in a <div> element. |
| 4138 options.findNext = true; |
| 4139 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4140 EXPECT_TRUE(activeNow); |
| 4141 |
| 4142 // Insert new text, which contains occurence of |searchText|. |
| 4143 frame->executeScript(WebScriptSource( |
| 4144 "var newTextNode = document.createTextNode('bar5 foo5');" |
| 4145 "var textArea = document.getElementsByTagName('textarea')[0];" |
| 4146 "document.body.insertBefore(newTextNode, textArea);")); |
| 4147 |
| 4148 // Find in a <input> element. |
| 4149 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4150 EXPECT_TRUE(activeNow); |
| 4151 |
| 4152 // Find in the inserted text node. |
| 4153 EXPECT_TRUE(frame->find(findIdentifier, searchText, options, false, 0, &acti
veNow)); |
| 4154 frame->stopFinding(false); |
| 4155 WebRange range = frame->selectionRange(); |
| 4156 EXPECT_EQ(5, range.startOffset()); |
| 4157 EXPECT_EQ(8, range.endOffset()); |
| 4158 EXPECT_TRUE(frame->document().focusedElement().isNull()); |
| 4159 EXPECT_FALSE(activeNow); |
| 4160 } |
| 4161 |
4115 static WebPoint topLeft(const WebRect& rect) | 4162 static WebPoint topLeft(const WebRect& rect) |
4116 { | 4163 { |
4117 return WebPoint(rect.x, rect.y); | 4164 return WebPoint(rect.x, rect.y); |
4118 } | 4165 } |
4119 | 4166 |
4120 static WebPoint bottomRightMinusOne(const WebRect& rect) | 4167 static WebPoint bottomRightMinusOne(const WebRect& rect) |
4121 { | 4168 { |
4122 // FIXME: If we don't subtract 1 from the x- and y-coordinates of the | 4169 // FIXME: If we don't subtract 1 from the x- and y-coordinates of the |
4123 // selection bounds, selectRange() will select the *next* element. That's | 4170 // selection bounds, selectRange() will select the *next* element. That's |
4124 // strictly correct, as hit-testing checks the pixel to the lower-right of | 4171 // strictly correct, as hit-testing checks the pixel to the lower-right of |
(...skipping 4309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8434 } | 8481 } |
8435 | 8482 |
8436 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8483 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
8437 { | 8484 { |
8438 swapLocalFrameToRemoteFrame(); | 8485 swapLocalFrameToRemoteFrame(); |
8439 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8486 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
8440 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8487 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
8441 } | 8488 } |
8442 | 8489 |
8443 } // namespace blink | 8490 } // namespace blink |
OLD | NEW |