| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/pickle.h" | 13 #include "base/pickle.h" |
| 14 #include "base/string16.h" |
| 14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
| 18 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 19 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 19 #include "ui/base/dragdrop/drag_drop_types.h" | 20 #include "ui/base/dragdrop/drag_drop_types.h" |
| 20 #include "ui/base/ime/text_input_client.h" | 21 #include "ui/base/ime/text_input_client.h" |
| 21 #include "ui/base/keycodes/keyboard_codes.h" | 22 #include "ui/base/keycodes/keyboard_codes.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/gfx/render_text.h" | 24 #include "ui/gfx/render_text.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 InitTextfield(Textfield::STYLE_DEFAULT); | 377 InitTextfield(Textfield::STYLE_DEFAULT); |
| 377 SendKeyEvent(ui::VKEY_C, true, false); | 378 SendKeyEvent(ui::VKEY_C, true, false); |
| 378 EXPECT_STR_EQ("C", textfield_->text()); | 379 EXPECT_STR_EQ("C", textfield_->text()); |
| 379 EXPECT_STR_EQ("C", last_contents_); | 380 EXPECT_STR_EQ("C", last_contents_); |
| 380 last_contents_.clear(); | 381 last_contents_.clear(); |
| 381 | 382 |
| 382 SendKeyEvent(ui::VKEY_R, false, false); | 383 SendKeyEvent(ui::VKEY_R, false, false); |
| 383 EXPECT_STR_EQ("Cr", textfield_->text()); | 384 EXPECT_STR_EQ("Cr", textfield_->text()); |
| 384 EXPECT_STR_EQ("Cr", last_contents_); | 385 EXPECT_STR_EQ("Cr", last_contents_); |
| 385 | 386 |
| 386 textfield_->SetText(ASCIIToUTF16("")); | 387 textfield_->SetText(string16()); |
| 387 SendKeyEvent(ui::VKEY_C, true, false, true); | 388 SendKeyEvent(ui::VKEY_C, true, false, true); |
| 388 SendKeyEvent(ui::VKEY_C, false, false, true); | 389 SendKeyEvent(ui::VKEY_C, false, false, true); |
| 389 SendKeyEvent(ui::VKEY_1, false, false, true); | 390 SendKeyEvent(ui::VKEY_1, false, false, true); |
| 390 SendKeyEvent(ui::VKEY_1, true, false, true); | 391 SendKeyEvent(ui::VKEY_1, true, false, true); |
| 391 SendKeyEvent(ui::VKEY_1, true, false, false); | 392 SendKeyEvent(ui::VKEY_1, true, false, false); |
| 392 EXPECT_STR_EQ("cC1!!", textfield_->text()); | 393 EXPECT_STR_EQ("cC1!!", textfield_->text()); |
| 393 EXPECT_STR_EQ("cC1!!", last_contents_); | 394 EXPECT_STR_EQ("cC1!!", last_contents_); |
| 394 } | 395 } |
| 395 | 396 |
| 396 TEST_F(NativeTextfieldViewsTest, ControlAndSelectTest) { | 397 TEST_F(NativeTextfieldViewsTest, ControlAndSelectTest) { |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 #else | 1565 #else |
| 1565 EXPECT_EQ(500U, textfield_->GetCursorPosition()); | 1566 EXPECT_EQ(500U, textfield_->GetCursorPosition()); |
| 1566 #endif | 1567 #endif |
| 1567 #endif // !defined(OS_WIN) | 1568 #endif // !defined(OS_WIN) |
| 1568 | 1569 |
| 1569 // Reset locale. | 1570 // Reset locale. |
| 1570 base::i18n::SetICUDefaultLocale(locale); | 1571 base::i18n::SetICUDefaultLocale(locale); |
| 1571 } | 1572 } |
| 1572 | 1573 |
| 1573 } // namespace views | 1574 } // namespace views |
| OLD | NEW |