diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-09 21:55:27 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-09 21:55:27 +0000 |
commit | 6d993dd6e077ebff6b06eb96b438c824e8278a11 (patch) | |
tree | 21857026b14a1e03baddcbe8799c055fa6f91a2b /ash/drag_drop | |
parent | 480850718000d048a919695e41626be13ef16b71 (diff) | |
download | chromium_src-6d993dd6e077ebff6b06eb96b438c824e8278a11.zip chromium_src-6d993dd6e077ebff6b06eb96b438c824e8278a11.tar.gz chromium_src-6d993dd6e077ebff6b06eb96b438c824e8278a11.tar.bz2 |
aura: refactor clipboard code and implement format conversion and basic
versioning.
BUG=97845
TEST=clipboard unittests pass.
Review URL: http://codereview.chromium.org/9120009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r-- | ash/drag_drop/drag_drop_controller_unittest.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 35fa1d9..49273ce 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -11,6 +11,7 @@ #include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/views/events/event.h" @@ -429,6 +430,18 @@ TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) { } TEST_F(DragDropControllerTest, DragCopiesDataToClipboardTest) { + ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); + { + // We first clear the clipboard. + ui::ScopedClipboardWriter scw(cb); + scw.WriteWebSmartPaste(); + } + EXPECT_FALSE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), + ui::Clipboard::BUFFER_STANDARD)); + std::string result; + cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); + EXPECT_EQ("", result); + scoped_ptr<views::Widget> widget(CreateNewWidget()); DragTestView* drag_view = new DragTestView; AddViewToWidgetAndResize(widget.get(), drag_view); @@ -439,14 +452,13 @@ TEST_F(DragDropControllerTest, DragCopiesDataToClipboardTest) { aura::MouseEvent event(ui::ET_MOUSE_PRESSED, point, ui::EF_LEFT_MOUSE_BUTTON); aura::RootWindow::GetInstance()->DispatchMouseEvent(&event); + point.Offset(0, drag_view->VerticalDragThreshold() + 1); aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, point, ui::EF_LEFT_MOUSE_BUTTON); aura::RootWindow::GetInstance()->DispatchMouseEvent(&drag_event); - ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), ui::Clipboard::BUFFER_STANDARD)); - std::string result; cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); EXPECT_EQ(data_str, result); } |