| 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 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 WebElement element = webView->mainFrame()->document().getElementById("messag
e"); | 1981 WebElement element = webView->mainFrame()->document().getElementById("messag
e"); |
| 1982 // Expect not to see duplication of events. | 1982 // Expect not to see duplication of events. |
| 1983 EXPECT_STREQ("blurfocus", element.textContent().utf8().data()); | 1983 EXPECT_STREQ("blurfocus", element.textContent().utf8().data()); |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 TEST_F(WebViewTest, SmartClipData) | 1986 TEST_F(WebViewTest, SmartClipData) |
| 1987 { | 1987 { |
| 1988 static const char* kExpectedClipText = "\nPrice 10,000,000won"; | 1988 static const char* kExpectedClipText = "\nPrice 10,000,000won"; |
| 1989 static const char* kExpectedClipHtml = | 1989 static const char* kExpectedClipHtml = |
| 1990 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 1990 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 1991 "solid rgb(135, 206, 235); float: left; width: 190px; height: 30px; " | 1991 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 1992 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 1992 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 1993 "normal; font-variant: normal; font-weight: normal; letter-spacing: " | 1993 "normal; font-variant: normal; font-weight: normal; letter-spacing: " |
| 1994 "normal; line-height: normal; orphans: auto; text-align: start; " | 1994 "normal; line-height: normal; orphans: auto; text-align: start; " |
| 1995 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 1995 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 1996 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " | 1996 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " |
| 1997 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 1997 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
| 1998 "10px; border: 2px solid rgb(135, 206, 235); float: left; width: " | 1998 "10px; border: 2px solid skyblue; float: left; width: " |
| 1999 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 1999 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
| 2000 "font-size: 8px; font-style: normal; font-variant: normal; " | 2000 "font-size: 8px; font-style: normal; font-variant: normal; " |
| 2001 "font-weight: normal; letter-spacing: normal; line-height: normal; " | 2001 "font-weight: normal; letter-spacing: normal; line-height: normal; " |
| 2002 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " | 2002 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " |
| 2003 "none; white-space: normal; widows: 1; word-spacing: 0px; " | 2003 "none; white-space: normal; widows: 1; word-spacing: 0px; " |
| 2004 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; | 2004 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; |
| 2005 WebString clipText; | 2005 WebString clipText; |
| 2006 WebString clipHtml; | 2006 WebString clipHtml; |
| 2007 WebRect clipRect; | 2007 WebRect clipRect; |
| 2008 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2008 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
| 2009 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 2009 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
| 2010 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 2010 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
| 2011 webView->resize(WebSize(500, 500)); | 2011 webView->resize(WebSize(500, 500)); |
| 2012 webView->layout(); | 2012 webView->layout(); |
| 2013 WebRect cropRect(300, 125, 152, 50); | 2013 WebRect cropRect(300, 125, 152, 50); |
| 2014 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 2014 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
| 2015 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 2015 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
| 2016 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 2016 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
| 2017 } | 2017 } |
| 2018 | 2018 |
| 2019 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) | 2019 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) |
| 2020 { | 2020 { |
| 2021 static const char* kExpectedClipText = "\nPrice 10,000,000won"; | 2021 static const char* kExpectedClipText = "\nPrice 10,000,000won"; |
| 2022 static const char* kExpectedClipHtml = | 2022 static const char* kExpectedClipHtml = |
| 2023 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 2023 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
| 2024 "solid rgb(135, 206, 235); float: left; width: 190px; height: 30px; " | 2024 "solid skyblue; float: left; width: 190px; height: 30px; " |
| 2025 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 2025 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
| 2026 "normal; font-variant: normal; font-weight: normal; letter-spacing: " | 2026 "normal; font-variant: normal; font-weight: normal; letter-spacing: " |
| 2027 "normal; line-height: normal; orphans: auto; text-align: start; " | 2027 "normal; line-height: normal; orphans: auto; text-align: start; " |
| 2028 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 2028 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
| 2029 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " | 2029 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " |
| 2030 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 2030 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
| 2031 "10px; border: 2px solid rgb(135, 206, 235); float: left; width: " | 2031 "10px; border: 2px solid skyblue; float: left; width: " |
| 2032 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 2032 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
| 2033 "font-size: 8px; font-style: normal; font-variant: normal; " | 2033 "font-size: 8px; font-style: normal; font-variant: normal; " |
| 2034 "font-weight: normal; letter-spacing: normal; line-height: normal; " | 2034 "font-weight: normal; letter-spacing: normal; line-height: normal; " |
| 2035 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " | 2035 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " |
| 2036 "none; white-space: normal; widows: 1; word-spacing: 0px; " | 2036 "none; white-space: normal; widows: 1; word-spacing: 0px; " |
| 2037 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; | 2037 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; |
| 2038 WebString clipText; | 2038 WebString clipText; |
| 2039 WebString clipHtml; | 2039 WebString clipHtml; |
| 2040 WebRect clipRect; | 2040 WebRect clipRect; |
| 2041 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 2041 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3023 for (size_t i = 0; i < renders.size(); ++i) { | 3023 for (size_t i = 0; i < renders.size(); ++i) { |
| 3024 double docStartTime = frame->domWindow()->document()->loader()->timing()
.monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; | 3024 double docStartTime = frame->domWindow()->document()->loader()->timing()
.monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; |
| 3025 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); | 3025 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); |
| 3026 double docFinishTime = frame->domWindow()->document()->loader()->timing(
).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; | 3026 double docFinishTime = frame->domWindow()->document()->loader()->timing(
).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; |
| 3027 double docDuration = docFinishTime - docStartTime; | 3027 double docDuration = docFinishTime - docStartTime; |
| 3028 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); | 3028 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); |
| 3029 } | 3029 } |
| 3030 } | 3030 } |
| 3031 | 3031 |
| 3032 } // namespace blink | 3032 } // namespace blink |
| OLD | NEW |