| 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 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 } | 2154 } |
| 2155 | 2155 |
| 2156 TEST_F(WebViewTest, SmartClipData) | 2156 TEST_F(WebViewTest, SmartClipData) |
| 2157 { | 2157 { |
| 2158 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2158 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
| 2159 static const char kExpectedClipHtml[] = | 2159 static const char kExpectedClipHtml[] = |
| 2160 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2160 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 2161 "solid skyblue; float: left; width: 190px; height: 30px; " | 2161 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 2162 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2162 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 2163 "normal; font-variant: normal; font-weight: normal; letter-spacing: " | 2163 "normal; font-variant: normal; font-weight: normal; letter-spacing: " |
| 2164 "normal; line-height: normal; orphans: auto; text-align: start; " | 2164 "normal; line-height: 8px; orphans: auto; text-align: start; " |
| 2165 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2165 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 2166 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " | 2166 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " |
| 2167 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2167 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
| 2168 "10px; border: 2px solid skyblue; float: left; width: " | 2168 "10px; border: 2px solid skyblue; float: left; width: " |
| 2169 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2169 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
| 2170 "font-size: 8px; font-style: normal; font-variant: normal; " | 2170 "font-size: 8px; font-style: normal; font-variant: normal; " |
| 2171 "font-weight: normal; letter-spacing: normal; line-height: normal; " | 2171 "font-weight: normal; letter-spacing: normal; line-height: 8px; " |
| 2172 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " | 2172 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " |
| 2173 "none; white-space: normal; widows: 1; word-spacing: 0px; " | 2173 "none; white-space: normal; widows: 1; word-spacing: 0px; " |
| 2174 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; | 2174 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; |
| 2175 WebString clipText; | 2175 WebString clipText; |
| 2176 WebString clipHtml; | 2176 WebString clipHtml; |
| 2177 WebRect clipRect; | 2177 WebRect clipRect; |
| 2178 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2178 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
| 2179 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2179 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
| 2180 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2180 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
| 2181 webView->resize(WebSize(500, 500)); | 2181 webView->resize(WebSize(500, 500)); |
| 2182 webView->updateAllLifecyclePhases(); | 2182 webView->updateAllLifecyclePhases(); |
| 2183 WebRect cropRect(300, 125, 152, 50); | 2183 WebRect cropRect(300, 125, 152, 50); |
| 2184 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 2184 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
| 2185 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 2185 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
| 2186 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 2186 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
| 2187 } | 2187 } |
| 2188 | 2188 |
| 2189 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) | 2189 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) |
| 2190 { | 2190 { |
| 2191 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 2191 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
| 2192 static const char kExpectedClipHtml[] = | 2192 static const char kExpectedClipHtml[] = |
| 2193 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2193 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 2194 "solid skyblue; float: left; width: 190px; height: 30px; " | 2194 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 2195 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2195 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 2196 "normal; font-variant: normal; font-weight: normal; letter-spacing: " | 2196 "normal; font-variant: normal; font-weight: normal; letter-spacing: " |
| 2197 "normal; line-height: normal; orphans: auto; text-align: start; " | 2197 "normal; line-height: 8px; orphans: auto; text-align: start; " |
| 2198 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2198 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 2199 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " | 2199 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " |
| 2200 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2200 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
| 2201 "10px; border: 2px solid skyblue; float: left; width: " | 2201 "10px; border: 2px solid skyblue; float: left; width: " |
| 2202 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2202 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
| 2203 "font-size: 8px; font-style: normal; font-variant: normal; " | 2203 "font-size: 8px; font-style: normal; font-variant: normal; " |
| 2204 "font-weight: normal; letter-spacing: normal; line-height: normal; " | 2204 "font-weight: normal; letter-spacing: normal; line-height: 8px; " |
| 2205 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " | 2205 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " |
| 2206 "none; white-space: normal; widows: 1; word-spacing: 0px; " | 2206 "none; white-space: normal; widows: 1; word-spacing: 0px; " |
| 2207 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; | 2207 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; |
| 2208 WebString clipText; | 2208 WebString clipText; |
| 2209 WebString clipHtml; | 2209 WebString clipHtml; |
| 2210 WebRect clipRect; | 2210 WebRect clipRect; |
| 2211 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2211 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
| 2212 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2212 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
| 2213 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2213 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
| 2214 webView->resize(WebSize(500, 500)); | 2214 webView->resize(WebSize(500, 500)); |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3291 frame->setAutofillClient(&client); | 3291 frame->setAutofillClient(&client); |
| 3292 webView->setInitialFocus(false); | 3292 webView->setInitialFocus(false); |
| 3293 | 3293 |
| 3294 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3294 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
| 3295 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3295 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3296 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3296 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3297 frame->setAutofillClient(0); | 3297 frame->setAutofillClient(0); |
| 3298 } | 3298 } |
| 3299 | 3299 |
| 3300 } // namespace blink | 3300 } // namespace blink |
| OLD | NEW |