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

Unified Diff: ui/views/view_unittest.cc

Issue 10911074: Change how ui::Clipboard is accessed so there's only one per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for kaiwang Created 8 years, 3 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 | « ui/views/test/test_views_delegate.cc ('k') | ui/views/views_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view_unittest.cc
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index 45d83b50c74c1716aab4139ec6a17fd4bd07f531..5b087938ef09a843362fdbedc976a80facb6f018 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -1168,8 +1168,6 @@ TEST_F(ViewTest, Textfield) {
const string16 kExtraText = ASCIIToUTF16("Pretty deep, Philip!");
const string16 kEmptyString;
- ui::Clipboard clipboard;
-
Widget* widget = new Widget;
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
params.bounds = gfx::Rect(0, 0, 100, 100);
@@ -1206,7 +1204,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
const string16 kReadOnlyText = ASCIIToUTF16("Read only");
const string16 kPasswordText = ASCIIToUTF16("Password! ** Secret stuff **");
- ui::Clipboard clipboard;
+ ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
Widget* widget = new Widget;
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
@@ -1235,7 +1233,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
::SendMessage(normal->GetTestingHandle(), WM_CUT, 0, 0);
string16 result;
- clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
+ clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
EXPECT_EQ(kNormalText, result);
normal->SetText(kNormalText); // Let's revert to the original content.
@@ -1243,7 +1241,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
read_only->SelectAll(false);
::SendMessage(read_only->GetTestingHandle(), WM_CUT, 0, 0);
result.clear();
- clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
+ clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
// Cut should have failed, so the clipboard content should not have changed.
EXPECT_EQ(kNormalText, result);
@@ -1251,7 +1249,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
password->SelectAll(false);
::SendMessage(password->GetTestingHandle(), WM_CUT, 0, 0);
result.clear();
- clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
+ clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
// Cut should have failed, so the clipboard content should not have changed.
EXPECT_EQ(kNormalText, result);
@@ -1264,19 +1262,19 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
read_only->SelectAll(false);
::SendMessage(read_only->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
- clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
+ clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
EXPECT_EQ(kReadOnlyText, result);
normal->SelectAll(false);
::SendMessage(normal->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
- clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
+ clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
EXPECT_EQ(kNormalText, result);
password->SelectAll(false);
::SendMessage(password->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
- clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
+ clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
// We don't let you copy from an obscured field, clipboard should not have
// changed.
EXPECT_EQ(kNormalText, result);
« no previous file with comments | « ui/views/test/test_views_delegate.cc ('k') | ui/views/views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698