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

Unified Diff: views/controls/textfield/textfield_views_model_unittest.cc

Issue 6132009: Delete test view delegate at end of test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/views/controls/textfield
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/textfield/textfield_views_model_unittest.cc
diff --git a/views/controls/textfield/textfield_views_model_unittest.cc b/views/controls/textfield/textfield_views_model_unittest.cc
index 388c8c3953fb7e8bd6448f72036c251013c2af26..1ef17239a0d27f59ac34842c668bebc540ef1212 100644
--- a/views/controls/textfield/textfield_views_model_unittest.cc
+++ b/views/controls/textfield/textfield_views_model_unittest.cc
@@ -289,7 +289,10 @@ TEST(TextfieldViewsModelTest, SetText) {
}
TEST(TextfieldViewsModelTest, Clipboard) {
- views::ViewsDelegate::views_delegate = new TestViewsDelegate();
+ scoped_ptr<TestViewsDelegate> test_views_delegate(new TestViewsDelegate());
+ views::ViewsDelegate* original_delegate =
+ views::ViewsDelegate::views_delegate;
+ views::ViewsDelegate::views_delegate = test_views_delegate.get();
ui::Clipboard* clipboard
= views::ViewsDelegate::views_delegate->GetClipboard();
string16 initial_clipboard_text;
@@ -339,6 +342,9 @@ TEST(TextfieldViewsModelTest, Clipboard) {
EXPECT_STR_EQ("HELLO HELLO WORLD", clipboard_text);
EXPECT_STR_EQ("HELLO HELLO HELLO HELLO WORLD", model.text());
EXPECT_EQ(29U, model.cursor_pos());
+
+ // Restore original delegate.
+ views::ViewsDelegate::views_delegate = original_delegate;
}
} // namespace views
« 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