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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 scoped_ptr<views::Textfield> target_; | 140 scoped_ptr<views::Textfield> target_; |
141 }; | 141 }; |
142 | 142 |
143 base::string16 GetClipboardText(ui::ClipboardType type) { | 143 base::string16 GetClipboardText(ui::ClipboardType type) { |
144 base::string16 text; | 144 base::string16 text; |
145 ui::Clipboard::GetForCurrentThread()->ReadText(type, &text); | 145 ui::Clipboard::GetForCurrentThread()->ReadText(type, &text); |
146 return text; | 146 return text; |
147 } | 147 } |
148 | 148 |
149 void SetClipboardText(ui::ClipboardType type, const std::string& text) { | 149 void SetClipboardText(ui::ClipboardType type, const std::string& text) { |
150 ui::ScopedClipboardWriter(ui::Clipboard::GetForCurrentThread(), type) | 150 ui::ScopedClipboardWriter(type).WriteText(ASCIIToUTF16(text)); |
151 .WriteText(ASCIIToUTF16(text)); | |
152 } | 151 } |
153 | 152 |
154 } // namespace | 153 } // namespace |
155 | 154 |
156 namespace views { | 155 namespace views { |
157 | 156 |
158 class TextfieldTest : public ViewsTestBase, public TextfieldController { | 157 class TextfieldTest : public ViewsTestBase, public TextfieldController { |
159 public: | 158 public: |
160 TextfieldTest() | 159 TextfieldTest() |
161 : widget_(NULL), | 160 : widget_(NULL), |
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 TextfieldDestroyerController controller(textfield_); | 2062 TextfieldDestroyerController controller(textfield_); |
2064 EXPECT_TRUE(controller.target()); | 2063 EXPECT_TRUE(controller.target()); |
2065 | 2064 |
2066 // Send a key to trigger OnKeyEvent(). | 2065 // Send a key to trigger OnKeyEvent(). |
2067 SendKeyEvent('X'); | 2066 SendKeyEvent('X'); |
2068 | 2067 |
2069 EXPECT_FALSE(controller.target()); | 2068 EXPECT_FALSE(controller.target()); |
2070 } | 2069 } |
2071 | 2070 |
2072 } // namespace views | 2071 } // namespace views |
OLD | NEW |