| 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 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3085 TEST_P(WebViewTest, SmartClipData) { | 3085 TEST_P(WebViewTest, SmartClipData) { |
| 3086 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 3086 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
| 3087 static const char kExpectedClipHtml[] = | 3087 static const char kExpectedClipHtml[] = |
| 3088 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 3088 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 3089 "solid skyblue; float: left; width: 190px; height: 30px; " | 3089 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 3090 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 3090 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 3091 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 3091 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
| 3092 "font-weight: normal; letter-spacing: " | 3092 "font-weight: normal; letter-spacing: " |
| 3093 "normal; orphans: 2; text-align: start; " | 3093 "normal; orphans: 2; text-align: start; " |
| 3094 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 3094 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 3095 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: " | 3095 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
| 3096 "auto; text-decoration-style: initial; text-decoration-color: initial;" | 3096 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
| 3097 "\">Air conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 3097 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: 10px; " |
| 3098 "10px; border: 2px solid skyblue; float: left; width: " | 3098 "border: 2px solid skyblue; float: left; width: 190px; height: 30px; " |
| 3099 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 3099 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 3100 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 3100 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
| 3101 "font-variant-caps: normal; font-weight: normal; " | 3101 "font-weight: normal; letter-spacing: normal; orphans: 2; text-align: " |
| 3102 "letter-spacing: normal; orphans: 2; " | 3102 "start; text-indent: 0px; text-transform: none; white-space: normal; " |
| 3103 "text-align: start; text-indent: 0px; text-transform: " | 3103 "widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
| 3104 "none; white-space: normal; widows: 2; word-spacing: 0px; " | 3104 "text-decoration-style: initial; text-decoration-color: initial;\">Price " |
| 3105 "-webkit-text-stroke-width: 0px; caret-color: auto; " | 3105 "10,000,000won</div>"; |
| 3106 "text-decoration-style: initial; text-decoration-color: initial;\">" | |
| 3107 "Price 10,000,000won</div>"; | |
| 3108 WebString clipText; | 3106 WebString clipText; |
| 3109 WebString clipHtml; | 3107 WebString clipHtml; |
| 3110 WebRect clipRect; | 3108 WebRect clipRect; |
| 3111 URLTestHelpers::registerMockedURLFromBaseURL( | 3109 URLTestHelpers::registerMockedURLFromBaseURL( |
| 3112 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); | 3110 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); |
| 3113 URLTestHelpers::registerMockedURLFromBaseURL( | 3111 URLTestHelpers::registerMockedURLFromBaseURL( |
| 3114 WebString::fromUTF8(m_baseURL.c_str()), | 3112 WebString::fromUTF8(m_baseURL.c_str()), |
| 3115 WebString::fromUTF8("smartclip.html")); | 3113 WebString::fromUTF8("smartclip.html")); |
| 3116 WebView* webView = | 3114 WebView* webView = |
| 3117 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); | 3115 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); |
| 3118 webView->resize(WebSize(500, 500)); | 3116 webView->resize(WebSize(500, 500)); |
| 3119 webView->updateAllLifecyclePhases(); | 3117 webView->updateAllLifecyclePhases(); |
| 3120 WebRect cropRect(300, 125, 152, 50); | 3118 WebRect cropRect(300, 125, 152, 50); |
| 3121 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 3119 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
| 3122 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 3120 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
| 3123 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 3121 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
| 3124 } | 3122 } |
| 3125 | 3123 |
| 3126 TEST_P(WebViewTest, SmartClipDataWithPinchZoom) { | 3124 TEST_P(WebViewTest, SmartClipDataWithPinchZoom) { |
| 3127 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 3125 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
| 3128 static const char kExpectedClipHtml[] = | 3126 static const char kExpectedClipHtml[] = |
| 3129 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 3127 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 3130 "solid skyblue; float: left; width: 190px; height: 30px; " | 3128 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 3131 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 3129 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 3132 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 3130 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
| 3133 "font-weight: normal; letter-spacing: " | 3131 "font-weight: normal; letter-spacing: " |
| 3134 "normal; orphans: 2; text-align: start; " | 3132 "normal; orphans: 2; text-align: start; " |
| 3135 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 3133 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 3136 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: " | 3134 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
| 3137 "auto; text-decoration-style: initial; text-decoration-color: initial;" | 3135 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
| 3138 "\">Air conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 3136 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: 10px; " |
| 3139 "10px; border: 2px solid skyblue; float: left; width: " | 3137 "border: 2px solid skyblue; float: left; width: 190px; height: 30px; " |
| 3140 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 3138 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 3141 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 3139 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
| 3142 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal; " | 3140 "font-weight: normal; letter-spacing: normal; orphans: 2; text-align: " |
| 3143 "orphans: 2; text-align: start; text-indent: 0px; " | 3141 "start; text-indent: 0px; text-transform: none; white-space: normal; " |
| 3144 "text-transform: none; white-space: normal; widows: 2; " | 3142 "widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
| 3145 "word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: auto; " | 3143 "text-decoration-style: initial; text-decoration-color: initial;\">Price " |
| 3146 "text-decoration-style: initial; text-decoration-color: initial;\">" | 3144 "10,000,000won</div>"; |
| 3147 "Price 10,000,000won</div>"; | |
| 3148 WebString clipText; | 3145 WebString clipText; |
| 3149 WebString clipHtml; | 3146 WebString clipHtml; |
| 3150 WebRect clipRect; | 3147 WebRect clipRect; |
| 3151 URLTestHelpers::registerMockedURLFromBaseURL( | 3148 URLTestHelpers::registerMockedURLFromBaseURL( |
| 3152 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); | 3149 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); |
| 3153 URLTestHelpers::registerMockedURLFromBaseURL( | 3150 URLTestHelpers::registerMockedURLFromBaseURL( |
| 3154 WebString::fromUTF8(m_baseURL.c_str()), | 3151 WebString::fromUTF8(m_baseURL.c_str()), |
| 3155 WebString::fromUTF8("smartclip.html")); | 3152 WebString::fromUTF8("smartclip.html")); |
| 3156 WebView* webView = | 3153 WebView* webView = |
| 3157 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); | 3154 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4357 .translate(50, 55) | 4354 .translate(50, 55) |
| 4358 .scale(1. / 2.f); | 4355 .scale(1. / 2.f); |
| 4359 EXPECT_EQ(expectedMatrix, | 4356 EXPECT_EQ(expectedMatrix, |
| 4360 webViewImpl->getDeviceEmulationTransformForTesting()); | 4357 webViewImpl->getDeviceEmulationTransformForTesting()); |
| 4361 // visibleContentRect doesn't change. | 4358 // visibleContentRect doesn't change. |
| 4362 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4359 EXPECT_EQ(IntRect(50, 55, 50, 75), |
| 4363 *devToolsEmulator->visibleContentRectForPainting()); | 4360 *devToolsEmulator->visibleContentRectForPainting()); |
| 4364 } | 4361 } |
| 4365 | 4362 |
| 4366 } // namespace blink | 4363 } // namespace blink |
| OLD | NEW |