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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 EXPECT_EQ(-1, info.compositionStart); | 739 EXPECT_EQ(-1, info.compositionStart); |
740 EXPECT_EQ(-1, info.compositionEnd); | 740 EXPECT_EQ(-1, info.compositionEnd); |
741 } | 741 } |
742 | 742 |
743 TEST_F(WebViewTest, IsSelectionAnchorFirst) | 743 TEST_F(WebViewTest, IsSelectionAnchorFirst) |
744 { | 744 { |
745 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 745 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
746 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); | 746 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
747 WebFrame* frame = webView->mainFrame(); | 747 WebFrame* frame = webView->mainFrame(); |
748 | 748 |
| 749 webView->setPageScaleFactorLimits(1, 1); |
749 webView->setInitialFocus(false); | 750 webView->setInitialFocus(false); |
750 frame->setEditableSelectionOffsets(4, 10); | 751 frame->setEditableSelectionOffsets(4, 10); |
751 EXPECT_TRUE(webView->isSelectionAnchorFirst()); | 752 EXPECT_TRUE(webView->isSelectionAnchorFirst()); |
752 WebRect anchor; | 753 WebRect anchor; |
753 WebRect focus; | 754 WebRect focus; |
754 webView->selectionBounds(anchor, focus); | 755 webView->selectionBounds(anchor, focus); |
755 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y))
; | 756 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y))
; |
756 EXPECT_FALSE(webView->isSelectionAnchorFirst()); | 757 EXPECT_FALSE(webView->isSelectionAnchorFirst()); |
757 } | 758 } |
758 | 759 |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 WebElement element = webView->mainFrame()->document().getElementById("messag
e"); | 1449 WebElement element = webView->mainFrame()->document().getElementById("messag
e"); |
1449 // Expect not to see duplication of events. | 1450 // Expect not to see duplication of events. |
1450 EXPECT_STREQ("blurfocus", element.innerText().utf8().data()); | 1451 EXPECT_STREQ("blurfocus", element.innerText().utf8().data()); |
1451 } | 1452 } |
1452 | 1453 |
1453 TEST_F(WebViewTest, SmartClipData) | 1454 TEST_F(WebViewTest, SmartClipData) |
1454 { | 1455 { |
1455 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); | 1456 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("Ahem.ttf")); |
1456 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); | 1457 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("smartclip.html")); |
1457 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 1458 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
| 1459 webView->setPageScaleFactorLimits(1, 1); |
1458 webView->resize(WebSize(500, 500)); | 1460 webView->resize(WebSize(500, 500)); |
1459 webView->layout(); | 1461 webView->layout(); |
1460 WebRect cropRect(300, 125, 100, 50); | 1462 WebRect cropRect(300, 125, 100, 50); |
1461 | 1463 |
1462 // FIXME: We should test the structure of the data we get back. | 1464 // FIXME: We should test the structure of the data we get back. |
1463 EXPECT_FALSE(webView->getSmartClipData(cropRect).isEmpty()); | 1465 EXPECT_FALSE(webView->getSmartClipData(cropRect).isEmpty()); |
1464 } | 1466 } |
1465 | 1467 |
1466 class CreateChildCounterFrameClient : public FrameTestHelpers::TestWebFrameClien
t { | 1468 class CreateChildCounterFrameClient : public FrameTestHelpers::TestWebFrameClien
t { |
1467 public: | 1469 public: |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 | 1944 |
1943 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 1945 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
1944 | 1946 |
1945 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); | 1947 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); |
1946 | 1948 |
1947 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 1949 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
1948 webView->setAutofillClient(0); | 1950 webView->setAutofillClient(0); |
1949 } | 1951 } |
1950 | 1952 |
1951 } // namespace | 1953 } // namespace |
OLD | NEW |