OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
6 | 6 |
7 #include "ash/test/aura_shell_test_base.h" | 7 #include "ash/test/aura_shell_test_base.h" |
8 #include "ash/wm/root_window_event_filter.h" | 8 #include "ash/wm/root_window_event_filter.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 drag_view->num_drag_updates_); | 394 drag_view->num_drag_updates_); |
395 EXPECT_EQ(0, drag_view->num_drops_); | 395 EXPECT_EQ(0, drag_view->num_drops_); |
396 EXPECT_EQ(0, drag_view->num_drag_exits_); | 396 EXPECT_EQ(0, drag_view->num_drag_exits_); |
397 EXPECT_TRUE(drag_view->drag_done_received_); | 397 EXPECT_TRUE(drag_view->drag_done_received_); |
398 } | 398 } |
399 | 399 |
400 TEST_F(DragDropControllerTest, DragCopiesDataToClipboardTest) { | 400 TEST_F(DragDropControllerTest, DragCopiesDataToClipboardTest) { |
401 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); | 401 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); |
402 { | 402 { |
403 // We first clear the clipboard. | 403 // We first clear the clipboard. |
404 ui::ScopedClipboardWriter scw(cb); | 404 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); |
405 scw.WriteWebSmartPaste(); | 405 scw.WriteWebSmartPaste(); |
406 } | 406 } |
407 EXPECT_FALSE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), | 407 EXPECT_FALSE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), |
408 ui::Clipboard::BUFFER_STANDARD)); | 408 ui::Clipboard::BUFFER_STANDARD)); |
409 std::string result; | 409 std::string result; |
410 cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); | 410 cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); |
411 EXPECT_EQ("", result); | 411 EXPECT_EQ("", result); |
412 | 412 |
413 scoped_ptr<views::Widget> widget(CreateNewWidget()); | 413 scoped_ptr<views::Widget> widget(CreateNewWidget()); |
414 DragTestView* drag_view = new DragTestView; | 414 DragTestView* drag_view = new DragTestView; |
415 AddViewToWidgetAndResize(widget.get(), drag_view); | 415 AddViewToWidgetAndResize(widget.get(), drag_view); |
416 | 416 |
417 aura::test::EventGenerator generator(widget->GetNativeView()); | 417 aura::test::EventGenerator generator(widget->GetNativeView()); |
418 ui::OSExchangeData data; | 418 ui::OSExchangeData data; |
419 std::string data_str("I am being dragged"); | 419 std::string data_str("I am being dragged"); |
420 data.SetString(ASCIIToUTF16(data_str)); | 420 data.SetString(ASCIIToUTF16(data_str)); |
421 | 421 |
422 generator.PressLeftButton(); | 422 generator.PressLeftButton(); |
423 generator.MoveMouseBy(0, drag_view->VerticalDragThreshold() + 1); | 423 generator.MoveMouseBy(0, drag_view->VerticalDragThreshold() + 1); |
424 | 424 |
425 EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), | 425 EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), |
426 ui::Clipboard::BUFFER_STANDARD)); | 426 ui::Clipboard::BUFFER_STANDARD)); |
427 cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); | 427 cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); |
428 EXPECT_EQ(data_str, result); | 428 EXPECT_EQ(data_str, result); |
429 } | 429 } |
430 | 430 |
431 } // namespace test | 431 } // namespace test |
432 } // namespace aura | 432 } // namespace aura |
OLD | NEW |