summaryrefslogtreecommitdiffstats
path: root/views/view_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/view_unittest.cc')
-rw-r--r--views/view_unittest.cc43
1 files changed, 42 insertions, 1 deletions
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 5dfa688..6484653 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -19,6 +19,7 @@
#include "views/event.h"
#include "views/focus/view_storage.h"
#include "views/view.h"
+#include "views/views_delegate.h"
#include "views/widget/root_view.h"
#include "views/widget/widget_win.h"
#include "views/window/dialog_delegate.h"
@@ -600,8 +601,45 @@ TEST_F(ViewTest, HitTestMasks) {
}
#if defined(OS_WIN)
+class TestViewsDelegate : public views::ViewsDelegate {
+ public:
+ TestViewsDelegate() {}
+ virtual ~TestViewsDelegate() {}
+
+ // Overridden from views::ViewsDelegate:
+ virtual Clipboard* GetClipboard() const {
+ if (!clipboard_.get()) {
+ // Note that we need a MessageLoop for the next call to work.
+ clipboard_.reset(new Clipboard);
+ }
+ return clipboard_.get();
+ }
+ virtual void SaveWindowPlacement(const std::wstring& window_name,
+ const gfx::Rect& bounds,
+ bool maximized) {
+ }
+ virtual bool GetSavedWindowBounds(const std::wstring& window_name,
+ gfx::Rect* bounds) const {
+ return false;
+ }
+ virtual bool GetSavedMaximizedState(const std::wstring& window_name,
+ bool* maximized) const {
+ return false;
+ }
+ virtual HICON GetDefaultWindowIcon() const {
+ return NULL;
+ }
+
+ private:
+ mutable scoped_ptr<Clipboard> clipboard_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate);
+};
+
// Tests that the Textfield view respond appropiately to cut/copy/paste.
-TEST_F(ViewTest, DISABLED_TextfieldCutCopyPaste) {
+TEST_F(ViewTest, TextfieldCutCopyPaste) {
+ views::ViewsDelegate::views_delegate = new TestViewsDelegate;
+
const std::wstring kNormalText = L"Normal";
const std::wstring kReadOnlyText = L"Read only";
const std::wstring kPasswordText = L"Password! ** Secret stuff **";
@@ -706,6 +744,9 @@ TEST_F(ViewTest, DISABLED_TextfieldCutCopyPaste) {
::SendMessage(normal->GetTestingHandle(), WM_PASTE, 0, 0);
::GetWindowText(normal->GetTestingHandle(), buffer, 1024);
EXPECT_EQ(kReadOnlyText, std::wstring(buffer));
+
+ delete views::ViewsDelegate::views_delegate;
+ views::ViewsDelegate::views_delegate = NULL;
}
#endif