OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 3180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3191 | 3191 |
3192 webView->setZoomLevel(3); | 3192 webView->setZoomLevel(3); |
3193 | 3193 |
3194 result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baseline Point); | 3194 result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baseline Point); |
3195 ASSERT_TRUE(!!result); | 3195 ASSERT_TRUE(!!result); |
3196 | 3196 |
3197 point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y); | 3197 point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y); |
3198 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi nt); | 3198 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi nt); |
3199 ASSERT_TRUE(!!result); | 3199 ASSERT_TRUE(!!result); |
3200 } | 3200 } |
3201 | |
3202 TEST_F(WebViewTest, WebSubstringUtilIframe) | |
3203 { | |
3204 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("single_iframe.html")); | |
3205 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("visible_iframe.html")); | |
bokan
2016/08/26 19:10:31
I don't think you have to register iframe loads bu
EhsanK
2016/08/26 20:14:48
Unfortunately, I can't remove it since this CHECK
bokan
2016/08/26 20:23:19
Ok, it's fine as-is, thanks for trying.
| |
3206 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "single _iframe.html"); | |
3207 webView->settings()->setDefaultFontSize(12); | |
3208 webView->settings()->setJavaScriptEnabled(true); | |
3209 webView->resize(WebSize(400, 400)); | |
3210 WebLocalFrameImpl* mainFrame = webView->mainFrameImpl(); | |
3211 WebLocalFrameImpl* childFrame = WebLocalFrameImpl::fromFrame(toLocalFrame(ma inFrame->frame()->tree().firstChild())); | |
3212 | |
3213 WebPoint baselinePoint; | |
3214 NSAttributedString* result = WebSubstringUtil::attributedSubstringInRange(ch ildFrame, 11, 7, &baselinePoint); | |
3215 ASSERT_TRUE(!!result); | |
bokan
2016/08/26 19:10:31
Nit: no double-bang needed. Even better: ASSERT_NE
EhsanK
2016/08/26 20:14:48
Thanks! Done.
| |
3216 | |
3217 WebPoint point(baselinePoint.x, mainFrame->frameView()->height() - baselineP oint.y); | |
3218 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi nt); | |
3219 ASSERT_TRUE(!!result); | |
3220 | |
3221 int yBeforeChange = baselinePoint.y; | |
3222 | |
3223 // Now move the <iframe> down by 100px. | |
3224 mainFrame->executeScript(WebScriptSource( | |
3225 "document.querySelector('iframe').style.marginTop = '100px';")); | |
3226 | |
3227 point = WebPoint(point.x, point.y + 100); | |
3228 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi nt); | |
3229 ASSERT_TRUE(!!result); | |
3230 | |
3231 EXPECT_EQ(yBeforeChange, baselinePoint.y + 100); | |
3232 } | |
3233 | |
3201 #endif | 3234 #endif |
3202 | 3235 |
3203 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) | 3236 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) |
3204 { | 3237 { |
3205 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_password.html")); | 3238 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_password.html")); |
3206 MockAutofillClient client; | 3239 MockAutofillClient client; |
3207 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_ field_password.html", true); | 3240 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_ field_password.html", true); |
3208 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 3241 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
3209 frame->setAutofillClient(&client); | 3242 frame->setAutofillClient(&client); |
3210 webView->setInitialFocus(false); | 3243 webView->setInitialFocus(false); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3280 EXPECT_TRUE(webView->page()->defersLoading()); | 3313 EXPECT_TRUE(webView->page()->defersLoading()); |
3281 } | 3314 } |
3282 | 3315 |
3283 EXPECT_TRUE(webView->page()->defersLoading()); | 3316 EXPECT_TRUE(webView->page()->defersLoading()); |
3284 } | 3317 } |
3285 | 3318 |
3286 EXPECT_FALSE(webView->page()->defersLoading()); | 3319 EXPECT_FALSE(webView->page()->defersLoading()); |
3287 } | 3320 } |
3288 | 3321 |
3289 } // namespace blink | 3322 } // namespace blink |
OLD | NEW |