diff options
-rw-r--r-- | ui/base/clipboard/clipboard_aura.cc | 39 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_views_unittest.cc | 61 |
2 files changed, 50 insertions, 50 deletions
diff --git a/ui/base/clipboard/clipboard_aura.cc b/ui/base/clipboard/clipboard_aura.cc index 41162bb..21c1202 100644 --- a/ui/base/clipboard/clipboard_aura.cc +++ b/ui/base/clipboard/clipboard_aura.cc @@ -5,6 +5,7 @@ #include "ui/base/clipboard/clipboard.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "third_party/skia/include/core/SkBitmap.h" namespace ui { @@ -12,8 +13,35 @@ namespace ui { namespace { const char kMimeTypeBitmap[] = "image/bmp"; const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; + +// A mimimum clipboard implementation for simple text cut&paste. +class ClipboardData { + public: + ClipboardData() {} + virtual ~ClipboardData() {} + + const std::string& text() const { return utf8_text_; } + + void set_text(const std::string& text) { + utf8_text_ = text; + } + + private: + std::string utf8_text_; + + DISALLOW_COPY_AND_ASSIGN(ClipboardData); +}; + +ClipboardData* data = NULL; + +ClipboardData* GetClipboardData() { + if (!data) + data = new ClipboardData(); + return data; } +} // namespace + Clipboard::Clipboard() { NOTIMPLEMENTED(); } @@ -22,7 +50,10 @@ Clipboard::~Clipboard() { } void Clipboard::WriteObjects(const ObjectMap& objects) { - NOTIMPLEMENTED(); + for (ObjectMap::const_iterator iter = objects.begin(); + iter != objects.end(); ++iter) { + DispatchObject(static_cast<ObjectType>(iter->first), iter->second); + } } @@ -53,11 +84,11 @@ void Clipboard::ReadAvailableTypes(Buffer buffer, std::vector<string16>* types, } void Clipboard::ReadText(Buffer buffer, string16* result) const { - NOTIMPLEMENTED(); + *result = UTF8ToUTF16(GetClipboardData()->text()); } void Clipboard::ReadAsciiText(Buffer buffer, std::string* result) const { - NOTIMPLEMENTED(); + *result = GetClipboardData()->text(); } void Clipboard::ReadHTML(Buffer buffer, string16* markup, std::string* src_url, @@ -92,7 +123,7 @@ uint64 Clipboard::GetSequenceNumber() { } void Clipboard::WriteText(const char* text_data, size_t text_len) { - NOTIMPLEMENTED(); + GetClipboardData()->set_text(std::string(text_data, text_len)); } void Clipboard::WriteHTML(const char* markup_data, diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc index c9ed670..05c3d41 100644 --- a/views/controls/textfield/native_textfield_views_unittest.cc +++ b/views/controls/textfield/native_textfield_views_unittest.cc @@ -34,49 +34,18 @@ #include "views/widget/native_widget_private.h" #include "views/widget/widget.h" -// Bug http://crbug.com/99128 -#if defined(USE_AURA) && defined(OS_LINUX) -#define MAYBE_KeyTest FAILS_KeyTest -#define MAYBE_ControlAndSelectTest FAILS_ControlAndSelectTest -#define MAYBE_InsertionDeletionTest FAILS_InsertionDeletionTest -#define MAYBE_OnKeyPressReturnValueTest FAILS_OnKeyPressReturnValueTest -#define MAYBE_CursorMovement FAILS_CursorMovement - // Drag and drop for aura in linux hasn't been implemented yet. // Bug http://crbug.com/97845 +#if defined(USE_AURA) && defined(OS_LINUX) #define MAYBE_DragAndDrop_InitiateDrag DISABLED_DragAndDrop_InitiateDrag #define MAYBE_DragAndDrop_ToTheLeft DISABLED_DragAndDrop_ToTheLeft #define MAYBE_DragAndDrop_ToTheRight DISABLED_DragAndDrop_ToTheRight #define MAYBE_DragAndDrop_Canceled DISABLED_DragAndDrop_Canceled - -#define MAYBE_ReadOnlyTest FAILS_ReadOnlyTest -#define MAYBE_TextInputClientTest FAILS_TextInputClientTest -#define MAYBE_UndoRedoTest FAILS_UndoRedoTest -#define MAYBE_TextCursorDisplayTest FAILS_TextCursorDisplayTest -#define MAYBE_TextCursorDisplayInRTLTest FAILS_TextCursorDisplayInRTLTest -#define MAYBE_HitOutsideTextAreaTest FAILS_HitOutsideTextAreaTest -#define MAYBE_HitOutsideTextAreaInRTLTest FAILS_HitOutsideTextAreaInRTLTest -#define MAYBE_OverflowTest FAILS_OverflowTest -#define MAYBE_OverflowInRTLTest FAILS_OverflowInRTLTest #else -#define MAYBE_KeyTest KeyTest -#define MAYBE_ControlAndSelectTest ControlAndSelectTest -#define MAYBE_InsertionDeletionTest InsertionDeletionTest -#define MAYBE_OnKeyPressReturnValueTest OnKeyPressReturnValueTest -#define MAYBE_CursorMovement CursorMovement #define MAYBE_DragAndDrop_InitiateDrag DragAndDrop_InitiateDrag #define MAYBE_DragAndDrop_ToTheLeft DragAndDrop_ToTheLeft #define MAYBE_DragAndDrop_ToTheRight DragAndDrop_ToTheRight #define MAYBE_DragAndDrop_Canceled DragAndDrop_Canceled -#define MAYBE_ReadOnlyTest ReadOnlyTest -#define MAYBE_TextInputClientTest TextInputClientTest -#define MAYBE_UndoRedoTest UndoRedoTest -#define MAYBE_TextCursorDisplayTest TextCursorDisplayTest -#define MAYBE_TextCursorDisplayInRTLTest TextCursorDisplayInRTLTest -#define MAYBE_HitOutsideTextAreaTest HitOutsideTextAreaTest -#define MAYBE_HitOutsideTextAreaInRTLTest HitOutsideTextAreaInRTLTest -#define MAYBE_OverflowTest OverflowTest -#define MAYBE_OverflowInRTLTest OverflowInRTLTest #endif // OS_LINUX && USE_AURA namespace { @@ -379,7 +348,7 @@ TEST_F(NativeTextfieldViewsTest, ModelChangesTest) { EXPECT_TRUE(last_contents_.empty()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_KeyTest) { +TEST_F(NativeTextfieldViewsTest, KeyTest) { InitTextfield(Textfield::STYLE_DEFAULT); SendKeyEvent(ui::VKEY_C, true, false); EXPECT_STR_EQ("C", textfield_->text()); @@ -400,7 +369,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_KeyTest) { EXPECT_STR_EQ("cC1!!", last_contents_); } -TEST_F(NativeTextfieldViewsTest, MAYBE_ControlAndSelectTest) { +TEST_F(NativeTextfieldViewsTest, ControlAndSelectTest) { // Insert a test string in a textfield. InitTextfield(Textfield::STYLE_DEFAULT); textfield_->SetText(ASCIIToUTF16("one two three")); @@ -435,7 +404,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_ControlAndSelectTest) { EXPECT_STR_EQ("ZERO ", textfield_->GetSelectedText()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_InsertionDeletionTest) { +TEST_F(NativeTextfieldViewsTest, InsertionDeletionTest) { // Insert a test string in a textfield. InitTextfield(Textfield::STYLE_DEFAULT); char test_str[] = "this is a test"; @@ -564,7 +533,7 @@ TEST_F(NativeTextfieldViewsTest, TextInputType) { EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, GetTextInputType()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_OnKeyPressReturnValueTest) { +TEST_F(NativeTextfieldViewsTest, OnKeyPressReturnValueTest) { InitTextfield(Textfield::STYLE_DEFAULT); // Character keys will be handled by input method. @@ -595,7 +564,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_OnKeyPressReturnValueTest) { EXPECT_FALSE(textfield_->key_handled()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_CursorMovement) { +TEST_F(NativeTextfieldViewsTest, CursorMovement) { InitTextfield(Textfield::STYLE_DEFAULT); // Test with trailing whitespace. @@ -990,7 +959,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_Canceled) { } #endif -TEST_F(NativeTextfieldViewsTest, MAYBE_ReadOnlyTest) { +TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) { InitTextfield(Textfield::STYLE_DEFAULT); textfield_->SetText(ASCIIToUTF16(" one two three ")); textfield_->SetReadOnly(true); @@ -1047,7 +1016,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_ReadOnlyTest) { EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_TextInputClientTest) { +TEST_F(NativeTextfieldViewsTest, TextInputClientTest) { InitTextfield(Textfield::STYLE_DEFAULT); TextInputClient* client = textfield_->GetTextInputClient(); EXPECT_TRUE(client); @@ -1137,7 +1106,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_TextInputClientTest) { EXPECT_TRUE(textfield_->GetTextInputClient()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_UndoRedoTest) { +TEST_F(NativeTextfieldViewsTest, UndoRedoTest) { InitTextfield(Textfield::STYLE_DEFAULT); SendKeyEvent(ui::VKEY_A); EXPECT_STR_EQ("a", textfield_->text()); @@ -1245,7 +1214,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_UndoRedoTest) { EXPECT_STR_EQ("ab3", textfield_->text()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_TextCursorDisplayTest) { +TEST_F(NativeTextfieldViewsTest, TextCursorDisplayTest) { InitTextfield(Textfield::STYLE_DEFAULT); // LTR-RTL string in LTR context. SendKeyEvent('a'); @@ -1297,7 +1266,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_TextCursorDisplayTest) { EXPECT_LT(prev_x, x); } -TEST_F(NativeTextfieldViewsTest, MAYBE_TextCursorDisplayInRTLTest) { +TEST_F(NativeTextfieldViewsTest, TextCursorDisplayInRTLTest) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); @@ -1415,7 +1384,7 @@ TEST_F(NativeTextfieldViewsTest, HitInsideTextAreaTest) { } } -TEST_F(NativeTextfieldViewsTest, MAYBE_HitOutsideTextAreaTest) { +TEST_F(NativeTextfieldViewsTest, HitOutsideTextAreaTest) { InitTextfield(Textfield::STYLE_DEFAULT); // LTR-RTL string in LTR context. @@ -1455,7 +1424,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_HitOutsideTextAreaTest) { EXPECT_EQ(bound, GetCursorBounds()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_HitOutsideTextAreaInRTLTest) { +TEST_F(NativeTextfieldViewsTest, HitOutsideTextAreaInRTLTest) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); @@ -1509,7 +1478,7 @@ void OverflowCursorBoundTestVerifier(const gfx::Rect& display, EXPECT_GE(display.bottom(), bound.bottom()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_OverflowTest) { +TEST_F(NativeTextfieldViewsTest, OverflowTest) { InitTextfield(Textfield::STYLE_DEFAULT); string16 str; @@ -1539,7 +1508,7 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_OverflowTest) { EXPECT_EQ(501U, textfield_->GetCursorPosition()); } -TEST_F(NativeTextfieldViewsTest, MAYBE_OverflowInRTLTest) { +TEST_F(NativeTextfieldViewsTest, OverflowInRTLTest) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); |