Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: ui/views/controls/textfield/textfield_views_model_unittest.cc

Issue 9232075: Have ScopedClipboardWriter and Clipboard::WriteObjects take a buffer parameter. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix build error. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 5 #include <vector>
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 #if defined(USE_AURA) && defined(OS_LINUX) 489 #if defined(USE_AURA) && defined(OS_LINUX)
490 #define MAYBE_Clipboard DISABLED_Clipboard // http://crbug.com/97845 490 #define MAYBE_Clipboard DISABLED_Clipboard // http://crbug.com/97845
491 #else 491 #else
492 #define MAYBE_Clipboard Clipboard 492 #define MAYBE_Clipboard Clipboard
493 #endif 493 #endif
494 TEST_F(TextfieldViewsModelTest, MAYBE_Clipboard) { 494 TEST_F(TextfieldViewsModelTest, MAYBE_Clipboard) {
495 ui::Clipboard* clipboard 495 ui::Clipboard* clipboard
496 = views::ViewsDelegate::views_delegate->GetClipboard(); 496 = views::ViewsDelegate::views_delegate->GetClipboard();
497 string16 initial_clipboard_text = ASCIIToUTF16("initial text"); 497 string16 initial_clipboard_text = ASCIIToUTF16("initial text");
498 ui::ScopedClipboardWriter(clipboard).WriteText(initial_clipboard_text); 498 ui::ScopedClipboardWriter(
499 clipboard,
500 ui::Clipboard::BUFFER_STANDARD).WriteText(initial_clipboard_text);
499 501
500 string16 clipboard_text; 502 string16 clipboard_text;
501 TextfieldViewsModel model(NULL); 503 TextfieldViewsModel model(NULL);
502 model.Append(ASCIIToUTF16("HELLO WORLD")); 504 model.Append(ASCIIToUTF16("HELLO WORLD"));
503 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false); 505 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false);
504 506
505 // Test for cut: Empty selection. 507 // Test for cut: Empty selection.
506 EXPECT_FALSE(model.Cut()); 508 EXPECT_FALSE(model.Cut());
507 clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_text); 509 clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_text);
508 EXPECT_STR_EQ(UTF16ToUTF8(initial_clipboard_text), clipboard_text); 510 EXPECT_STR_EQ(UTF16ToUTF8(initial_clipboard_text), clipboard_text);
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 EXPECT_TRUE(model.Undo()); 1529 EXPECT_TRUE(model.Undo());
1528 EXPECT_STR_EQ("ABCDE", model.GetText()); 1530 EXPECT_STR_EQ("ABCDE", model.GetText());
1529 EXPECT_TRUE(model.Redo()); 1531 EXPECT_TRUE(model.Redo());
1530 EXPECT_STR_EQ("1234", model.GetText()); 1532 EXPECT_STR_EQ("1234", model.GetText());
1531 EXPECT_FALSE(model.Redo()); 1533 EXPECT_FALSE(model.Redo());
1532 1534
1533 // TODO(oshima): We need MockInputMethod to test the behavior with IME. 1535 // TODO(oshima): We need MockInputMethod to test the behavior with IME.
1534 } 1536 }
1535 1537
1536 } // namespace views 1538 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield_views_model.cc ('k') | webkit/glue/scoped_clipboard_writer_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698