| 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 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 { | 2162 { |
| 2163 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2163 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
| 2164 static const char kExpectedClipHtml[] = | 2164 static const char kExpectedClipHtml[] = |
| 2165 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2165 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 2166 "solid skyblue; float: left; width: 190px; height: 30px; " | 2166 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 2167 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2167 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 2168 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 2168 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
| 2169 "font-weight: normal; letter-spacing: " | 2169 "font-weight: normal; letter-spacing: " |
| 2170 "normal; line-height: normal; orphans: 2; text-align: start; " | 2170 "normal; line-height: normal; orphans: 2; text-align: start; " |
| 2171 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2171 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 2172 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " | 2172 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
| 2173 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
| 2173 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2174 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
| 2174 "10px; border: 2px solid skyblue; float: left; width: " | 2175 "10px; border: 2px solid skyblue; float: left; width: " |
| 2175 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2176 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
| 2176 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 2177 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
| 2177 "font-variant-caps: normal; font-weight: normal; " | 2178 "font-variant-caps: normal; font-weight: normal; " |
| 2178 "letter-spacing: normal; line-height: normal; orphans: 2; " | 2179 "letter-spacing: normal; line-height: normal; orphans: 2; " |
| 2179 "text-align: start; text-indent: 0px; text-transform: " | 2180 "text-align: start; text-indent: 0px; text-transform: " |
| 2180 "none; white-space: normal; widows: 2; word-spacing: 0px; " | 2181 "none; white-space: normal; widows: 2; word-spacing: 0px; " |
| 2181 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; | 2182 "-webkit-text-stroke-width: 0px; text-decoration-style: initial; " |
| 2183 "text-decoration-color: initial;\">Price 10,000,000won</div>"; |
| 2182 WebString clipText; | 2184 WebString clipText; |
| 2183 WebString clipHtml; | 2185 WebString clipHtml; |
| 2184 WebRect clipRect; | 2186 WebRect clipRect; |
| 2185 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2187 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
| 2186 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2188 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
| 2187 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2189 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
| 2188 webView->resize(WebSize(500, 500)); | 2190 webView->resize(WebSize(500, 500)); |
| 2189 webView->updateAllLifecyclePhases(); | 2191 webView->updateAllLifecyclePhases(); |
| 2190 WebRect cropRect(300, 125, 152, 50); | 2192 WebRect cropRect(300, 125, 152, 50); |
| 2191 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 2193 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
| 2192 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 2194 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
| 2193 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 2195 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
| 2194 } | 2196 } |
| 2195 | 2197 |
| 2196 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) | 2198 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) |
| 2197 { | 2199 { |
| 2198 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2200 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
| 2199 static const char kExpectedClipHtml[] = | 2201 static const char kExpectedClipHtml[] = |
| 2200 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2202 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 2201 "solid skyblue; float: left; width: 190px; height: 30px; " | 2203 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 2202 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2204 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 2203 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 2205 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
| 2204 "font-weight: normal; letter-spacing: " | 2206 "font-weight: normal; letter-spacing: " |
| 2205 "normal; line-height: normal; orphans: 2; text-align: start; " | 2207 "normal; line-height: normal; orphans: 2; text-align: start; " |
| 2206 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2208 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 2207 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " | 2209 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
| 2210 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
| 2208 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2211 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
| 2209 "10px; border: 2px solid skyblue; float: left; width: " | 2212 "10px; border: 2px solid skyblue; float: left; width: " |
| 2210 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2213 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
| 2211 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 2214 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
| 2212 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal;
" | 2215 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal;
" |
| 2213 "line-height: normal; orphans: 2; text-align: start; text-indent: 0px; " | 2216 "line-height: normal; orphans: 2; text-align: start; text-indent: 0px; " |
| 2214 "text-transform: none; white-space: normal; widows: 2; " | 2217 "text-transform: none; white-space: normal; widows: 2; " |
| 2215 "word-spacing: 0px; -webkit-text-stroke-width: 0px;\">" | 2218 "word-spacing: 0px; -webkit-text-stroke-width: 0px;" |
| 2219 " text-decoration-style: initial; text-decoration-color: initial;\">" |
| 2216 "Price 10,000,000won</div>"; | 2220 "Price 10,000,000won</div>"; |
| 2217 WebString clipText; | 2221 WebString clipText; |
| 2218 WebString clipHtml; | 2222 WebString clipHtml; |
| 2219 WebRect clipRect; | 2223 WebRect clipRect; |
| 2220 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2224 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
| 2221 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2225 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
| 2222 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2226 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
| 2223 webView->resize(WebSize(500, 500)); | 2227 webView->resize(WebSize(500, 500)); |
| 2224 webView->updateAllLifecyclePhases(); | 2228 webView->updateAllLifecyclePhases(); |
| 2225 webView->setPageScaleFactor(1.5); | 2229 webView->setPageScaleFactor(1.5); |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3056 frame->setAutofillClient(&client); | 3060 frame->setAutofillClient(&client); |
| 3057 webView->setInitialFocus(false); | 3061 webView->setInitialFocus(false); |
| 3058 | 3062 |
| 3059 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3063 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
| 3060 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3064 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3061 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3065 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3062 frame->setAutofillClient(0); | 3066 frame->setAutofillClient(0); |
| 3063 } | 3067 } |
| 3064 | 3068 |
| 3065 } // namespace blink | 3069 } // namespace blink |
| OLD | NEW |