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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2312 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
2313 static const char kExpectedClipHtml[] = | 2313 static const char kExpectedClipHtml[] = |
2314 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2314 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
2315 "solid skyblue; float: left; width: 190px; height: 30px; " | 2315 "solid skyblue; float: left; width: 190px; height: 30px; " |
2316 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2316 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
2317 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 2317 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
2318 "font-weight: normal; letter-spacing: " | 2318 "font-weight: normal; letter-spacing: " |
2319 "normal; orphans: 2; text-align: start; " | 2319 "normal; orphans: 2; text-align: start; " |
2320 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2320 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
2321 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " | 2321 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
2322 "text-decoration-style: initial; text-decoration-color: initial;\">Air " | 2322 "text-decoration-style: solid; text-decoration-color: currentcolor;\">Ai
r " |
2323 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2323 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
2324 "10px; border: 2px solid skyblue; float: left; width: " | 2324 "10px; border: 2px solid skyblue; float: left; width: " |
2325 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2325 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
2326 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 2326 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
2327 "font-variant-caps: normal; font-weight: normal; " | 2327 "font-variant-caps: normal; font-weight: normal; " |
2328 "letter-spacing: normal; orphans: 2; " | 2328 "letter-spacing: normal; orphans: 2; " |
2329 "text-align: start; text-indent: 0px; text-transform: " | 2329 "text-align: start; text-indent: 0px; text-transform: " |
2330 "none; white-space: normal; widows: 2; word-spacing: 0px; " | 2330 "none; white-space: normal; widows: 2; word-spacing: 0px; " |
2331 "-webkit-text-stroke-width: 0px; text-decoration-style: initial; " | 2331 "-webkit-text-stroke-width: 0px; text-decoration-style: solid; " |
2332 "text-decoration-color: initial;\">Price 10,000,000won</div>"; | 2332 "text-decoration-color: currentcolor;\">Price 10,000,000won</div>"; |
2333 WebString clipText; | 2333 WebString clipText; |
2334 WebString clipHtml; | 2334 WebString clipHtml; |
2335 WebRect clipRect; | 2335 WebRect clipRect; |
2336 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2336 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
2337 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2337 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
2338 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2338 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
2339 webView->resize(WebSize(500, 500)); | 2339 webView->resize(WebSize(500, 500)); |
2340 webView->updateAllLifecyclePhases(); | 2340 webView->updateAllLifecyclePhases(); |
2341 WebRect cropRect(300, 125, 152, 50); | 2341 WebRect cropRect(300, 125, 152, 50); |
2342 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 2342 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
2343 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 2343 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
2344 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 2344 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
2345 } | 2345 } |
2346 | 2346 |
2347 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) | 2347 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) |
2348 { | 2348 { |
2349 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2349 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
2350 static const char kExpectedClipHtml[] = | 2350 static const char kExpectedClipHtml[] = |
2351 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2351 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
2352 "solid skyblue; float: left; width: 190px; height: 30px; " | 2352 "solid skyblue; float: left; width: 190px; height: 30px; " |
2353 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2353 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
2354 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 2354 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
2355 "font-weight: normal; letter-spacing: " | 2355 "font-weight: normal; letter-spacing: " |
2356 "normal; orphans: 2; text-align: start; " | 2356 "normal; orphans: 2; text-align: start; " |
2357 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2357 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
2358 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " | 2358 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
2359 "text-decoration-style: initial; text-decoration-color: initial;\">Air " | 2359 "text-decoration-style: solid; text-decoration-color: currentcolor;\">Ai
r " |
2360 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2360 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
2361 "10px; border: 2px solid skyblue; float: left; width: " | 2361 "10px; border: 2px solid skyblue; float: left; width: " |
2362 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2362 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
2363 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 2363 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
2364 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal;
" | 2364 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal;
" |
2365 "orphans: 2; text-align: start; text-indent: 0px; " | 2365 "orphans: 2; text-align: start; text-indent: 0px; " |
2366 "text-transform: none; white-space: normal; widows: 2; " | 2366 "text-transform: none; white-space: normal; widows: 2; " |
2367 "word-spacing: 0px; -webkit-text-stroke-width: 0px;" | 2367 "word-spacing: 0px; -webkit-text-stroke-width: 0px;" |
2368 " text-decoration-style: initial; text-decoration-color: initial;\">" | 2368 " text-decoration-style: solid; text-decoration-color: currentcolor;\">" |
2369 "Price 10,000,000won</div>"; | 2369 "Price 10,000,000won</div>"; |
2370 WebString clipText; | 2370 WebString clipText; |
2371 WebString clipHtml; | 2371 WebString clipHtml; |
2372 WebRect clipRect; | 2372 WebRect clipRect; |
2373 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2373 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
2374 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2374 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
2375 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2375 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
2376 webView->resize(WebSize(500, 500)); | 2376 webView->resize(WebSize(500, 500)); |
2377 webView->updateAllLifecyclePhases(); | 2377 webView->updateAllLifecyclePhases(); |
2378 webView->setPageScaleFactor(1.5); | 2378 webView->setPageScaleFactor(1.5); |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3280 EXPECT_TRUE(webView->page()->defersLoading()); | 3280 EXPECT_TRUE(webView->page()->defersLoading()); |
3281 } | 3281 } |
3282 | 3282 |
3283 EXPECT_TRUE(webView->page()->defersLoading()); | 3283 EXPECT_TRUE(webView->page()->defersLoading()); |
3284 } | 3284 } |
3285 | 3285 |
3286 EXPECT_FALSE(webView->page()->defersLoading()); | 3286 EXPECT_FALSE(webView->page()->defersLoading()); |
3287 } | 3287 } |
3288 | 3288 |
3289 } // namespace blink | 3289 } // namespace blink |
OLD | NEW |