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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 EXPECT_EQ(2, info.selectionStart); | 1048 EXPECT_EQ(2, info.selectionStart); |
1049 EXPECT_EQ(2, info.selectionEnd); | 1049 EXPECT_EQ(2, info.selectionEnd); |
1050 EXPECT_EQ(-1, info.compositionStart); | 1050 EXPECT_EQ(-1, info.compositionStart); |
1051 EXPECT_EQ(-1, info.compositionEnd); | 1051 EXPECT_EQ(-1, info.compositionEnd); |
1052 } | 1052 } |
1053 | 1053 |
1054 TEST_F(WebViewTest, IsSelectionAnchorFirst) | 1054 TEST_F(WebViewTest, IsSelectionAnchorFirst) |
1055 { | 1055 { |
1056 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 1056 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
1057 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); | 1057 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
1058 WebFrame* frame = webView->mainFrame(); | 1058 WebLocalFrame* frame = webView->mainFrame()->toWebLocalFrame(); |
1059 | 1059 |
1060 webView->setInitialFocus(false); | 1060 webView->setInitialFocus(false); |
1061 frame->setEditableSelectionOffsets(4, 10); | 1061 frame->setEditableSelectionOffsets(4, 10); |
1062 EXPECT_TRUE(webView->isSelectionAnchorFirst()); | 1062 EXPECT_TRUE(webView->isSelectionAnchorFirst()); |
1063 WebRect anchor; | 1063 WebRect anchor; |
1064 WebRect focus; | 1064 WebRect focus; |
1065 webView->selectionBounds(anchor, focus); | 1065 webView->selectionBounds(anchor, focus); |
1066 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y))
; | 1066 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y))
; |
1067 EXPECT_FALSE(webView->isSelectionAnchorFirst()); | 1067 EXPECT_FALSE(webView->isSelectionAnchorFirst()); |
1068 } | 1068 } |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3129 frame->setAutofillClient(&client); | 3129 frame->setAutofillClient(&client); |
3130 webView->setInitialFocus(false); | 3130 webView->setInitialFocus(false); |
3131 | 3131 |
3132 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3132 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
3133 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3133 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
3134 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3134 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
3135 frame->setAutofillClient(0); | 3135 frame->setAutofillClient(0); |
3136 } | 3136 } |
3137 | 3137 |
3138 } // namespace blink | 3138 } // namespace blink |
OLD | NEW |