diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 20:26:50 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 20:26:50 +0000 |
commit | 8919c55c25dda90fcc7443855f8f96e4a0947e86 (patch) | |
tree | 61f004f948397a75e878d5792456ea0db654a57e /ui/views/view_unittest.cc | |
parent | fde2cb0bc16de6a5be9e671f90370fed30dc83e5 (diff) | |
download | chromium_src-8919c55c25dda90fcc7443855f8f96e4a0947e86.zip chromium_src-8919c55c25dda90fcc7443855f8f96e4a0947e86.tar.gz chromium_src-8919c55c25dda90fcc7443855f8f96e4a0947e86.tar.bz2 |
Change how ui::Clipboard is accessed so there's only one per thread.
Currently, there can be any number of Clipboard objects, which can be massively simplified. This removes interfaces for fetching the Clipboard and makes everyone go through a single static ui::Clipboard::GetForCurrentThread() access point.
BUG=130805
TBR=tc (change in webkit/ is trivial)
Review URL: https://chromiumcodereview.appspot.com/10911074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/view_unittest.cc')
-rw-r--r-- | ui/views/view_unittest.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index 45d83b5..5b08793 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); |