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 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 | 2276 |
2277 TEST_F(WebViewTest, SmartClipData) | 2277 TEST_F(WebViewTest, SmartClipData) |
2278 { | 2278 { |
2279 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2279 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
2280 static const char kExpectedClipHtml[] = | 2280 static const char kExpectedClipHtml[] = |
2281 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2281 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
2282 "solid skyblue; float: left; width: 190px; height: 30px; " | 2282 "solid skyblue; float: left; width: 190px; height: 30px; " |
2283 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2283 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
2284 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 2284 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
2285 "font-weight: normal; letter-spacing: " | 2285 "font-weight: normal; letter-spacing: " |
2286 "normal; line-height: normal; orphans: 2; text-align: start; " | 2286 "normal; orphans: 2; text-align: start; " |
2287 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2287 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
2288 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " | 2288 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
2289 "text-decoration-style: initial; text-decoration-color: initial;\">Air " | 2289 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
2290 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2290 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
2291 "10px; border: 2px solid skyblue; float: left; width: " | 2291 "10px; border: 2px solid skyblue; float: left; width: " |
2292 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2292 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
2293 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 2293 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
2294 "font-variant-caps: normal; font-weight: normal; " | 2294 "font-variant-caps: normal; font-weight: normal; " |
2295 "letter-spacing: normal; line-height: normal; orphans: 2; " | 2295 "letter-spacing: normal; orphans: 2; " |
2296 "text-align: start; text-indent: 0px; text-transform: " | 2296 "text-align: start; text-indent: 0px; text-transform: " |
2297 "none; white-space: normal; widows: 2; word-spacing: 0px; " | 2297 "none; white-space: normal; widows: 2; word-spacing: 0px; " |
2298 "-webkit-text-stroke-width: 0px; text-decoration-style: initial; " | 2298 "-webkit-text-stroke-width: 0px; text-decoration-style: initial; " |
2299 "text-decoration-color: initial;\">Price 10,000,000won</div>"; | 2299 "text-decoration-color: initial;\">Price 10,000,000won</div>"; |
2300 WebString clipText; | 2300 WebString clipText; |
2301 WebString clipHtml; | 2301 WebString clipHtml; |
2302 WebRect clipRect; | 2302 WebRect clipRect; |
2303 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2303 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
2304 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2304 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
2305 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2305 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
2306 webView->resize(WebSize(500, 500)); | 2306 webView->resize(WebSize(500, 500)); |
2307 webView->updateAllLifecyclePhases(); | 2307 webView->updateAllLifecyclePhases(); |
2308 WebRect cropRect(300, 125, 152, 50); | 2308 WebRect cropRect(300, 125, 152, 50); |
2309 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 2309 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
2310 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 2310 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
2311 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 2311 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
2312 } | 2312 } |
2313 | 2313 |
2314 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) | 2314 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) |
2315 { | 2315 { |
2316 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2316 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
2317 static const char kExpectedClipHtml[] = | 2317 static const char kExpectedClipHtml[] = |
2318 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2318 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
2319 "solid skyblue; float: left; width: 190px; height: 30px; " | 2319 "solid skyblue; float: left; width: 190px; height: 30px; " |
2320 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2320 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
2321 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 2321 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
2322 "font-weight: normal; letter-spacing: " | 2322 "font-weight: normal; letter-spacing: " |
2323 "normal; line-height: normal; orphans: 2; text-align: start; " | 2323 "normal; orphans: 2; text-align: start; " |
2324 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2324 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
2325 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " | 2325 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
2326 "text-decoration-style: initial; text-decoration-color: initial;\">Air " | 2326 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
2327 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2327 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
2328 "10px; border: 2px solid skyblue; float: left; width: " | 2328 "10px; border: 2px solid skyblue; float: left; width: " |
2329 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2329 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
2330 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 2330 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
2331 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal;
" | 2331 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal;
" |
2332 "line-height: normal; orphans: 2; text-align: start; text-indent: 0px; " | 2332 "orphans: 2; text-align: start; text-indent: 0px; " |
2333 "text-transform: none; white-space: normal; widows: 2; " | 2333 "text-transform: none; white-space: normal; widows: 2; " |
2334 "word-spacing: 0px; -webkit-text-stroke-width: 0px;" | 2334 "word-spacing: 0px; -webkit-text-stroke-width: 0px;" |
2335 " text-decoration-style: initial; text-decoration-color: initial;\">" | 2335 " text-decoration-style: initial; text-decoration-color: initial;\">" |
2336 "Price 10,000,000won</div>"; | 2336 "Price 10,000,000won</div>"; |
2337 WebString clipText; | 2337 WebString clipText; |
2338 WebString clipHtml; | 2338 WebString clipHtml; |
2339 WebRect clipRect; | 2339 WebRect clipRect; |
2340 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2340 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
2341 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2341 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
2342 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2342 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3177 frame->setAutofillClient(&client); | 3177 frame->setAutofillClient(&client); |
3178 webView->setInitialFocus(false); | 3178 webView->setInitialFocus(false); |
3179 | 3179 |
3180 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3180 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
3181 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3181 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
3182 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3182 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
3183 frame->setAutofillClient(0); | 3183 frame->setAutofillClient(0); |
3184 } | 3184 } |
3185 | 3185 |
3186 } // namespace blink | 3186 } // namespace blink |
OLD | NEW |