OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE); | 1010 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE); |
1011 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE, | 1011 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE, |
1012 textfield_->OnDragUpdated(drop)); | 1012 textfield_->OnDragUpdated(drop)); |
1013 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, textfield_->OnPerformDrop(drop)); | 1013 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, textfield_->OnPerformDrop(drop)); |
1014 EXPECT_STR_EQ("hello string world", textfield_->text()); | 1014 EXPECT_STR_EQ("hello string world", textfield_->text()); |
1015 | 1015 |
1016 // Ensure that textfields do not accept non-OSExchangeData::STRING types. | 1016 // Ensure that textfields do not accept non-OSExchangeData::STRING types. |
1017 ui::OSExchangeData bad_data; | 1017 ui::OSExchangeData bad_data; |
1018 bad_data.SetFilename(base::FilePath(FILE_PATH_LITERAL("x"))); | 1018 bad_data.SetFilename(base::FilePath(FILE_PATH_LITERAL("x"))); |
1019 ui::OSExchangeData::CustomFormat fmt = ui::Clipboard::GetBitmapFormatType(); | 1019 ui::OSExchangeData::CustomFormat fmt = ui::Clipboard::GetBitmapFormatType(); |
1020 bad_data.SetPickledData(fmt, Pickle()); | 1020 bad_data.SetPickledData(fmt, base::Pickle()); |
1021 bad_data.SetFileContents(base::FilePath(L"x"), "x"); | 1021 bad_data.SetFileContents(base::FilePath(L"x"), "x"); |
1022 bad_data.SetHtml(base::string16(ASCIIToUTF16("x")), GURL("x.org")); | 1022 bad_data.SetHtml(base::string16(ASCIIToUTF16("x")), GURL("x.org")); |
1023 ui::OSExchangeData::DownloadFileInfo download(base::FilePath(), NULL); | 1023 ui::OSExchangeData::DownloadFileInfo download(base::FilePath(), NULL); |
1024 bad_data.SetDownloadFileInfo(download); | 1024 bad_data.SetDownloadFileInfo(download); |
1025 EXPECT_FALSE(textfield_->CanDrop(bad_data)); | 1025 EXPECT_FALSE(textfield_->CanDrop(bad_data)); |
1026 } | 1026 } |
1027 #endif | 1027 #endif |
1028 | 1028 |
1029 TEST_F(TextfieldTest, DragAndDrop_InitiateDrag) { | 1029 TEST_F(TextfieldTest, DragAndDrop_InitiateDrag) { |
1030 InitTextfield(); | 1030 InitTextfield(); |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 | 2358 |
2359 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2359 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
2360 ui::AXViewState state_protected; | 2360 ui::AXViewState state_protected; |
2361 textfield_->GetAccessibleState(&state_protected); | 2361 textfield_->GetAccessibleState(&state_protected); |
2362 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2362 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
2363 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2363 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
2364 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2364 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
2365 } | 2365 } |
2366 | 2366 |
2367 } // namespace views | 2367 } // namespace views |
OLD | NEW |