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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 // Check that releasing in the same location does not alter the selection. | 708 // Check that releasing in the same location does not alter the selection. |
709 textfield_view_->OnMouseReleased(release); | 709 textfield_view_->OnMouseReleased(release); |
710 EXPECT_EQ(text_right, textfield_->GetSelectedText()); | 710 EXPECT_EQ(text_right, textfield_->GetSelectedText()); |
711 // Check that dragging from beyond the text length works too. | 711 // Check that dragging from beyond the text length works too. |
712 textfield_view_->OnMousePressed(click_b); | 712 textfield_view_->OnMousePressed(click_b); |
713 textfield_view_->OnMouseDragged(drag_left); | 713 textfield_view_->OnMouseDragged(drag_left); |
714 textfield_view_->OnMouseReleased(release); | 714 textfield_view_->OnMouseReleased(release); |
715 EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); | 715 EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); |
716 } | 716 } |
717 | 717 |
| 718 #if defined(OS_WIN) || defined(TOOLKIT_USES_GTK) |
718 TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { | 719 TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { |
719 InitTextfield(Textfield::STYLE_DEFAULT); | 720 InitTextfield(Textfield::STYLE_DEFAULT); |
720 textfield_->SetText(ASCIIToUTF16("hello world")); | 721 textfield_->SetText(ASCIIToUTF16("hello world")); |
721 | 722 |
722 ui::OSExchangeData data; | 723 ui::OSExchangeData data; |
723 string16 string(ASCIIToUTF16("string ")); | 724 string16 string(ASCIIToUTF16("string ")); |
724 data.SetString(string); | 725 data.SetString(string); |
725 int formats = 0; | 726 int formats = 0; |
726 std::set<OSExchangeData::CustomFormat> custom_formats; | 727 std::set<OSExchangeData::CustomFormat> custom_formats; |
727 | 728 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); | 763 bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); |
763 ui::OSExchangeData::DownloadFileInfo download(FilePath(), NULL); | 764 ui::OSExchangeData::DownloadFileInfo download(FilePath(), NULL); |
764 bad_data.SetDownloadFileInfo(download); | 765 bad_data.SetDownloadFileInfo(download); |
765 #else | 766 #else |
766 // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. | 767 // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. |
767 bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); | 768 bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); |
768 bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); | 769 bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); |
769 #endif | 770 #endif |
770 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); | 771 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); |
771 } | 772 } |
| 773 #endif |
772 | 774 |
773 #if !defined(TOUCH_UI) | 775 #if !defined(TOUCH_UI) |
774 TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { | 776 TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { |
775 InitTextfield(Textfield::STYLE_DEFAULT); | 777 InitTextfield(Textfield::STYLE_DEFAULT); |
776 textfield_->SetText(ASCIIToUTF16("hello string world")); | 778 textfield_->SetText(ASCIIToUTF16("hello string world")); |
777 | 779 |
778 // Ensure the textfield will provide selected text for drag data. | 780 // Ensure the textfield will provide selected text for drag data. |
779 string16 string; | 781 string16 string; |
780 ui::OSExchangeData data; | 782 ui::OSExchangeData data; |
781 const ui::Range kStringRange(6, 12); | 783 const ui::Range kStringRange(6, 12); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 EXPECT_EQ(0U, textfield_->GetCursorPosition()); | 1531 EXPECT_EQ(0U, textfield_->GetCursorPosition()); |
1530 #else | 1532 #else |
1531 EXPECT_EQ(500U, textfield_->GetCursorPosition()); | 1533 EXPECT_EQ(500U, textfield_->GetCursorPosition()); |
1532 #endif | 1534 #endif |
1533 | 1535 |
1534 // Reset locale. | 1536 // Reset locale. |
1535 base::i18n::SetICUDefaultLocale(locale); | 1537 base::i18n::SetICUDefaultLocale(locale); |
1536 } | 1538 } |
1537 | 1539 |
1538 } // namespace views | 1540 } // namespace views |
OLD | NEW |