OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 bad_data.SetDownloadFileInfo(download); | 790 bad_data.SetDownloadFileInfo(download); |
791 #else | 791 #else |
792 // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. | 792 // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. |
793 bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); | 793 bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); |
794 bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); | 794 bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); |
795 #endif | 795 #endif |
796 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); | 796 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); |
797 } | 797 } |
798 #endif | 798 #endif |
799 | 799 |
800 #if !defined(TOUCH_UI) | |
801 TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_InitiateDrag) { | 800 TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_InitiateDrag) { |
802 InitTextfield(Textfield::STYLE_DEFAULT); | 801 InitTextfield(Textfield::STYLE_DEFAULT); |
803 textfield_->SetText(ASCIIToUTF16("hello string world")); | 802 textfield_->SetText(ASCIIToUTF16("hello string world")); |
804 | 803 |
805 // Ensure the textfield will provide selected text for drag data. | 804 // Ensure the textfield will provide selected text for drag data. |
806 string16 string; | 805 string16 string; |
807 ui::OSExchangeData data; | 806 ui::OSExchangeData data; |
808 const ui::Range kStringRange(6, 12); | 807 const ui::Range kStringRange(6, 12); |
809 textfield_->SelectRange(kStringRange); | 808 textfield_->SelectRange(kStringRange); |
810 const gfx::Point kStringPoint(GetCursorPositionX(9), 0); | 809 const gfx::Point kStringPoint(GetCursorPositionX(9), 0); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 // "Cancel" the drag, via move and release over the selection, and OnDragDone. | 961 // "Cancel" the drag, via move and release over the selection, and OnDragDone. |
963 MouseEvent drag(ui::ET_MOUSE_DRAGGED, GetCursorPositionX(9), 0, | 962 MouseEvent drag(ui::ET_MOUSE_DRAGGED, GetCursorPositionX(9), 0, |
964 ui::EF_LEFT_BUTTON_DOWN); | 963 ui::EF_LEFT_BUTTON_DOWN); |
965 MouseEvent release(ui::ET_MOUSE_RELEASED, GetCursorPositionX(9), 0, | 964 MouseEvent release(ui::ET_MOUSE_RELEASED, GetCursorPositionX(9), 0, |
966 ui::EF_LEFT_BUTTON_DOWN); | 965 ui::EF_LEFT_BUTTON_DOWN); |
967 textfield_view_->OnMouseDragged(drag); | 966 textfield_view_->OnMouseDragged(drag); |
968 textfield_view_->OnMouseReleased(release); | 967 textfield_view_->OnMouseReleased(release); |
969 textfield_view_->OnDragDone(); | 968 textfield_view_->OnDragDone(); |
970 EXPECT_EQ(ASCIIToUTF16("hello world"), textfield_->text()); | 969 EXPECT_EQ(ASCIIToUTF16("hello world"), textfield_->text()); |
971 } | 970 } |
972 #endif | |
973 | 971 |
974 TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) { | 972 TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) { |
975 InitTextfield(Textfield::STYLE_DEFAULT); | 973 InitTextfield(Textfield::STYLE_DEFAULT); |
976 textfield_->SetText(ASCIIToUTF16(" one two three ")); | 974 textfield_->SetText(ASCIIToUTF16(" one two three ")); |
977 textfield_->SetReadOnly(true); | 975 textfield_->SetReadOnly(true); |
978 SendKeyEvent(ui::VKEY_HOME); | 976 SendKeyEvent(ui::VKEY_HOME); |
979 EXPECT_EQ(0U, textfield_->GetCursorPosition()); | 977 EXPECT_EQ(0U, textfield_->GetCursorPosition()); |
980 | 978 |
981 SendKeyEvent(ui::VKEY_END); | 979 SendKeyEvent(ui::VKEY_END); |
982 EXPECT_EQ(15U, textfield_->GetCursorPosition()); | 980 EXPECT_EQ(15U, textfield_->GetCursorPosition()); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 #else | 1564 #else |
1567 EXPECT_EQ(500U, textfield_->GetCursorPosition()); | 1565 EXPECT_EQ(500U, textfield_->GetCursorPosition()); |
1568 #endif | 1566 #endif |
1569 #endif // !defined(OS_WIN) | 1567 #endif // !defined(OS_WIN) |
1570 | 1568 |
1571 // Reset locale. | 1569 // Reset locale. |
1572 base::i18n::SetICUDefaultLocale(locale); | 1570 base::i18n::SetICUDefaultLocale(locale); |
1573 } | 1571 } |
1574 | 1572 |
1575 } // namespace views | 1573 } // namespace views |
OLD | NEW |