Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: views/controls/textfield/native_textfield_views_unittest.cc

Issue 8491035: Revert 109583 - Move views/ime/text_input_client.h to ui/base/ime/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Deleted: svn:mergeinfo
OLDNEW
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/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/base/clipboard/clipboard.h" 17 #include "ui/base/clipboard/clipboard.h"
18 #include "ui/base/clipboard/scoped_clipboard_writer.h" 18 #include "ui/base/clipboard/scoped_clipboard_writer.h"
19 #include "ui/base/dragdrop/drag_drop_types.h" 19 #include "ui/base/dragdrop/drag_drop_types.h"
20 #include "ui/base/ime/text_input_client.h"
21 #include "ui/base/keycodes/keyboard_codes.h" 20 #include "ui/base/keycodes/keyboard_codes.h"
22 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/gfx/render_text.h" 22 #include "ui/gfx/render_text.h"
24 #include "views/controls/textfield/native_textfield_views.h" 23 #include "views/controls/textfield/native_textfield_views.h"
25 #include "views/controls/textfield/textfield.h" 24 #include "views/controls/textfield/textfield.h"
26 #include "views/controls/textfield/textfield_controller.h" 25 #include "views/controls/textfield/textfield_controller.h"
27 #include "views/controls/textfield/textfield_views_model.h" 26 #include "views/controls/textfield/textfield_views_model.h"
28 #include "views/events/event.h" 27 #include "views/events/event.h"
29 #include "views/focus/focus_manager.h" 28 #include "views/focus/focus_manager.h"
30 #include "views/ime/mock_input_method.h" 29 #include "views/ime/mock_input_method.h"
30 #include "views/ime/text_input_client.h"
31 #include "views/test/test_views_delegate.h" 31 #include "views/test/test_views_delegate.h"
32 #include "views/test/views_test_base.h" 32 #include "views/test/views_test_base.h"
33 #include "views/views_delegate.h" 33 #include "views/views_delegate.h"
34 #include "views/widget/native_widget_private.h" 34 #include "views/widget/native_widget_private.h"
35 #include "views/widget/widget.h" 35 #include "views/widget/widget.h"
36 36
37 // Drag and drop for aura in linux hasn't been implemented yet. 37 // Drag and drop for aura in linux hasn't been implemented yet.
38 // Bug http://crbug.com/97845 38 // Bug http://crbug.com/97845
39 #if defined(USE_AURA) && defined(OS_LINUX) 39 #if defined(USE_AURA) && defined(OS_LINUX)
40 #define MAYBE_DragAndDrop_InitiateDrag DISABLED_DragAndDrop_InitiateDrag 40 #define MAYBE_DragAndDrop_InitiateDrag DISABLED_DragAndDrop_InitiateDrag
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 key_received_ = key_handled_ = false; 84 key_received_ = key_handled_ = false;
85 } 85 }
86 86
87 private: 87 private:
88 bool key_handled_; 88 bool key_handled_;
89 bool key_received_; 89 bool key_received_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(TestTextfield); 91 DISALLOW_COPY_AND_ASSIGN(TestTextfield);
92 }; 92 };
93 93
94 // A helper class for use with ui::TextInputClient::GetTextFromRange(). 94 // A helper class for use with TextInputClient::GetTextFromRange().
95 class GetTextHelper { 95 class GetTextHelper {
96 public: 96 public:
97 GetTextHelper() { 97 GetTextHelper() {
98 } 98 }
99 99
100 void set_text(const string16& text) { text_ = text; } 100 void set_text(const string16& text) { text_ = text; }
101 const string16& text() const { return text_; } 101 const string16& text() const { return text_; }
102 102
103 private: 103 private:
104 string16 text_; 104 string16 text_;
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 SendKeyEvent(ui::VKEY_DELETE); 1012 SendKeyEvent(ui::VKEY_DELETE);
1013 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); 1013 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText());
1014 SendKeyEvent(ui::VKEY_BACK); 1014 SendKeyEvent(ui::VKEY_BACK);
1015 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); 1015 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText());
1016 SendKeyEvent(ui::VKEY_T); 1016 SendKeyEvent(ui::VKEY_T);
1017 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); 1017 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText());
1018 } 1018 }
1019 1019
1020 TEST_F(NativeTextfieldViewsTest, TextInputClientTest) { 1020 TEST_F(NativeTextfieldViewsTest, TextInputClientTest) {
1021 InitTextfield(Textfield::STYLE_DEFAULT); 1021 InitTextfield(Textfield::STYLE_DEFAULT);
1022 ui::TextInputClient* client = textfield_->GetTextInputClient(); 1022 TextInputClient* client = textfield_->GetTextInputClient();
1023 EXPECT_TRUE(client); 1023 EXPECT_TRUE(client);
1024 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, client->GetTextInputType()); 1024 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, client->GetTextInputType());
1025 1025
1026 textfield_->SetText(ASCIIToUTF16("0123456789")); 1026 textfield_->SetText(ASCIIToUTF16("0123456789"));
1027 ui::Range range; 1027 ui::Range range;
1028 EXPECT_TRUE(client->GetTextRange(&range)); 1028 EXPECT_TRUE(client->GetTextRange(&range));
1029 EXPECT_EQ(0U, range.start()); 1029 EXPECT_EQ(0U, range.start());
1030 EXPECT_EQ(10U, range.end()); 1030 EXPECT_EQ(10U, range.end());
1031 1031
1032 EXPECT_TRUE(client->SetSelectionRange(ui::Range(1, 4))); 1032 EXPECT_TRUE(client->SetSelectionRange(ui::Range(1, 4)));
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 EXPECT_EQ(0U, textfield_->GetCursorPosition()); 1545 EXPECT_EQ(0U, textfield_->GetCursorPosition());
1546 #else 1546 #else
1547 EXPECT_EQ(500U, textfield_->GetCursorPosition()); 1547 EXPECT_EQ(500U, textfield_->GetCursorPosition());
1548 #endif 1548 #endif
1549 1549
1550 // Reset locale. 1550 // Reset locale.
1551 base::i18n::SetICUDefaultLocale(locale); 1551 base::i18n::SetICUDefaultLocale(locale);
1552 } 1552 }
1553 1553
1554 } // namespace views 1554 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/textfield/native_textfield_views.cc ('k') | views/controls/textfield/native_textfield_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698