OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 gfx::Point drop_point(GetCursorPositionX(6), 0); | 864 gfx::Point drop_point(GetCursorPositionX(6), 0); |
865 ui::DropTargetEvent drop(data, drop_point, drop_point, | 865 ui::DropTargetEvent drop(data, drop_point, drop_point, |
866 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE); | 866 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE); |
867 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE, | 867 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE, |
868 textfield_view_->OnDragUpdated(drop)); | 868 textfield_view_->OnDragUpdated(drop)); |
869 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, textfield_view_->OnPerformDrop(drop)); | 869 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, textfield_view_->OnPerformDrop(drop)); |
870 EXPECT_STR_EQ("hello string world", textfield_->text()); | 870 EXPECT_STR_EQ("hello string world", textfield_->text()); |
871 | 871 |
872 // Ensure that textfields do not accept non-OSExchangeData::STRING types. | 872 // Ensure that textfields do not accept non-OSExchangeData::STRING types. |
873 ui::OSExchangeData bad_data; | 873 ui::OSExchangeData bad_data; |
874 bad_data.SetFilename(FilePath(FILE_PATH_LITERAL("x"))); | 874 bad_data.SetFilename(base::FilePath(FILE_PATH_LITERAL("x"))); |
875 #if defined(OS_WIN) | 875 #if defined(OS_WIN) |
876 ui::OSExchangeData::CustomFormat fmt = CF_BITMAP; | 876 ui::OSExchangeData::CustomFormat fmt = CF_BITMAP; |
877 bad_data.SetPickledData(fmt, Pickle()); | 877 bad_data.SetPickledData(fmt, Pickle()); |
878 bad_data.SetFileContents(FilePath(L"x"), "x"); | 878 bad_data.SetFileContents(base::FilePath(L"x"), "x"); |
879 bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); | 879 bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); |
880 ui::OSExchangeData::DownloadFileInfo download(FilePath(), NULL); | 880 ui::OSExchangeData::DownloadFileInfo download(base::FilePath(), NULL); |
881 bad_data.SetDownloadFileInfo(download); | 881 bad_data.SetDownloadFileInfo(download); |
882 #endif | 882 #endif |
883 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); | 883 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); |
884 } | 884 } |
885 #endif | 885 #endif |
886 | 886 |
887 TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { | 887 TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { |
888 InitTextfield(Textfield::STYLE_DEFAULT); | 888 InitTextfield(Textfield::STYLE_DEFAULT); |
889 textfield_->SetText(ASCIIToUTF16("hello string world")); | 889 textfield_->SetText(ASCIIToUTF16("hello string world")); |
890 | 890 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 EXPECT_EQ(char_rect[i], actual_rect) << " i=" << i; | 1696 EXPECT_EQ(char_rect[i], actual_rect) << " i=" << i; |
1697 } | 1697 } |
1698 | 1698 |
1699 // Return false if the index is out of range. | 1699 // Return false if the index is out of range. |
1700 EXPECT_FALSE(client->GetCompositionCharacterBounds(char_count, &rect)); | 1700 EXPECT_FALSE(client->GetCompositionCharacterBounds(char_count, &rect)); |
1701 EXPECT_FALSE(client->GetCompositionCharacterBounds(char_count + 1, &rect)); | 1701 EXPECT_FALSE(client->GetCompositionCharacterBounds(char_count + 1, &rect)); |
1702 EXPECT_FALSE(client->GetCompositionCharacterBounds(char_count + 100, &rect)); | 1702 EXPECT_FALSE(client->GetCompositionCharacterBounds(char_count + 100, &rect)); |
1703 } | 1703 } |
1704 | 1704 |
1705 } // namespace views | 1705 } // namespace views |
OLD | NEW |