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

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

Issue 8486024: Fix flakyness with TextfieldViewsModelTest.Clipboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 } 503 }
504 504
505 #if defined(USE_AURA) && defined(OS_LINUX) 505 #if defined(USE_AURA) && defined(OS_LINUX)
506 #define MAYBE_Clipboard DISABLED_Clipboard // http://crbug.com/97845 506 #define MAYBE_Clipboard DISABLED_Clipboard // http://crbug.com/97845
507 #else 507 #else
508 #define MAYBE_Clipboard Clipboard 508 #define MAYBE_Clipboard Clipboard
509 #endif 509 #endif
510 TEST_F(TextfieldViewsModelTest, MAYBE_Clipboard) { 510 TEST_F(TextfieldViewsModelTest, MAYBE_Clipboard) {
511 ui::Clipboard* clipboard 511 ui::Clipboard* clipboard
512 = views::ViewsDelegate::views_delegate->GetClipboard(); 512 = views::ViewsDelegate::views_delegate->GetClipboard();
513 string16 initial_clipboard_text; 513 string16 initial_clipboard_text = ASCIIToUTF16("initial text");
514 clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &initial_clipboard_text); 514 ui::ScopedClipboardWriter(clipboard).WriteText(initial_clipboard_text);
515
515 string16 clipboard_text; 516 string16 clipboard_text;
516 TextfieldViewsModel model(NULL); 517 TextfieldViewsModel model(NULL);
517 model.Append(ASCIIToUTF16("HELLO WORLD")); 518 model.Append(ASCIIToUTF16("HELLO WORLD"));
518 model.MoveCursorRight(gfx::LINE_BREAK, false); 519 model.MoveCursorRight(gfx::LINE_BREAK, false);
519 520
520 // Test for cut: Empty selection. 521 // Test for cut: Empty selection.
521 EXPECT_FALSE(model.Cut()); 522 EXPECT_FALSE(model.Cut());
522 clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_text); 523 clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_text);
523 EXPECT_STR_EQ(UTF16ToUTF8(initial_clipboard_text), clipboard_text); 524 EXPECT_STR_EQ(UTF16ToUTF8(initial_clipboard_text), clipboard_text);
524 EXPECT_STR_EQ("HELLO WORLD", model.GetText()); 525 EXPECT_STR_EQ("HELLO WORLD", model.GetText());
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 EXPECT_TRUE(model.Undo()); 1526 EXPECT_TRUE(model.Undo());
1526 EXPECT_STR_EQ("ABCDE", model.GetText()); 1527 EXPECT_STR_EQ("ABCDE", model.GetText());
1527 EXPECT_TRUE(model.Redo()); 1528 EXPECT_TRUE(model.Redo());
1528 EXPECT_STR_EQ("1234", model.GetText()); 1529 EXPECT_STR_EQ("1234", model.GetText());
1529 EXPECT_FALSE(model.Redo()); 1530 EXPECT_FALSE(model.Redo());
1530 1531
1531 // TODO(oshima): We need MockInputMethod to test the behavior with IME. 1532 // TODO(oshima): We need MockInputMethod to test the behavior with IME.
1532 } 1533 }
1533 1534
1534 } // namespace views 1535 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698