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