summaryrefslogtreecommitdiffstats
path: root/views/view_unittest.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 20:54:06 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 20:54:06 +0000
commit9163266850ce5d2c871afbd362940a2d04246e23 (patch)
tree31fdefc8be174c686bb02539ba2672be844fbaed /views/view_unittest.cc
parentb7f02c6a9cb5cb58af781761b34895f40d35ddf1 (diff)
downloadchromium_src-9163266850ce5d2c871afbd362940a2d04246e23.zip
chromium_src-9163266850ce5d2c871afbd362940a2d04246e23.tar.gz
chromium_src-9163266850ce5d2c871afbd362940a2d04246e23.tar.bz2
Make Textfield more portable.
Split off Windows bits into NativeTextfieldWin class obscured behind NativeTextfieldWrapper interface. The APIs aren't perfectly tidy yet but this is a good first pass. BUG=none TEST=make sure you can still edit text fields, run the view unit tests. Review URL: http://codereview.chromium.org/113940 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view_unittest.cc')
-rw-r--r--views/view_unittest.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 3e6543d..2ccf8b5 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -621,26 +621,26 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
//
// Test cut.
//
- ASSERT_TRUE(normal->GetNativeComponent());
+ ASSERT_TRUE(normal->GetTestingHandle());
normal->SelectAll();
- ::SendMessage(normal->GetNativeComponent(), WM_CUT, 0, 0);
+ ::SendMessage(normal->GetTestingHandle(), WM_CUT, 0, 0);
string16 result;
clipboard.ReadText(&result);
EXPECT_EQ(kNormalText, result);
normal->SetText(kNormalText); // Let's revert to the original content.
- ASSERT_TRUE(read_only->GetNativeComponent());
+ ASSERT_TRUE(read_only->GetTestingHandle());
read_only->SelectAll();
- ::SendMessage(read_only->GetNativeComponent(), WM_CUT, 0, 0);
+ ::SendMessage(read_only->GetTestingHandle(), WM_CUT, 0, 0);
result.clear();
clipboard.ReadText(&result);
// Cut should have failed, so the clipboard content should not have changed.
EXPECT_EQ(kNormalText, result);
- ASSERT_TRUE(password->GetNativeComponent());
+ ASSERT_TRUE(password->GetTestingHandle());
password->SelectAll();
- ::SendMessage(password->GetNativeComponent(), WM_CUT, 0, 0);
+ ::SendMessage(password->GetTestingHandle(), WM_CUT, 0, 0);
result.clear();
clipboard.ReadText(&result);
// Cut should have failed, so the clipboard content should not have changed.
@@ -653,19 +653,19 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
// Let's start with read_only as the clipboard already contains the content
// of normal.
read_only->SelectAll();
- ::SendMessage(read_only->GetNativeComponent(), WM_COPY, 0, 0);
+ ::SendMessage(read_only->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
clipboard.ReadText(&result);
EXPECT_EQ(kReadOnlyText, result);
normal->SelectAll();
- ::SendMessage(normal->GetNativeComponent(), WM_COPY, 0, 0);
+ ::SendMessage(normal->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
clipboard.ReadText(&result);
EXPECT_EQ(kNormalText, result);
password->SelectAll();
- ::SendMessage(password->GetNativeComponent(), WM_COPY, 0, 0);
+ ::SendMessage(password->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
clipboard.ReadText(&result);
// We don't let you copy from a password field, clipboard should not have
@@ -681,23 +681,23 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
// Attempting to copy kNormalText in a read-only text-field should fail.
read_only->SelectAll();
- ::SendMessage(read_only->GetNativeComponent(), WM_KEYDOWN, 0, 0);
+ ::SendMessage(read_only->GetTestingHandle(), WM_KEYDOWN, 0, 0);
wchar_t buffer[1024] = { 0 };
- ::GetWindowText(read_only->GetNativeComponent(), buffer, 1024);
+ ::GetWindowText(read_only->GetTestingHandle(), buffer, 1024);
EXPECT_EQ(kReadOnlyText, std::wstring(buffer));
password->SelectAll();
- ::SendMessage(password->GetNativeComponent(), WM_PASTE, 0, 0);
- ::GetWindowText(password->GetNativeComponent(), buffer, 1024);
+ ::SendMessage(password->GetTestingHandle(), WM_PASTE, 0, 0);
+ ::GetWindowText(password->GetTestingHandle(), buffer, 1024);
EXPECT_EQ(kNormalText, std::wstring(buffer));
// Copy from read_only so the string we are pasting is not the same as the
// current one.
read_only->SelectAll();
- ::SendMessage(read_only->GetNativeComponent(), WM_COPY, 0, 0);
+ ::SendMessage(read_only->GetTestingHandle(), WM_COPY, 0, 0);
normal->SelectAll();
- ::SendMessage(normal->GetNativeComponent(), WM_PASTE, 0, 0);
- ::GetWindowText(normal->GetNativeComponent(), buffer, 1024);
+ ::SendMessage(normal->GetTestingHandle(), WM_PASTE, 0, 0);
+ ::GetWindowText(normal->GetTestingHandle(), buffer, 1024);
EXPECT_EQ(kReadOnlyText, std::wstring(buffer));
}
#endif
@@ -810,12 +810,12 @@ TEST_F(ViewTest, DISABLED_RerouteMouseWheelTest) {
EXPECT_EQ(60, scroll_view->GetVisibleRect().y());
// Then the text-field.
- ::SendMessage(view_with_controls->text_field_->GetNativeComponent(),
+ ::SendMessage(view_with_controls->text_field_->GetTestingHandle(),
WM_MOUSEWHEEL, MAKEWPARAM(0, -20), MAKELPARAM(250, 250));
EXPECT_EQ(80, scroll_view->GetVisibleRect().y());
// Ensure we don't scroll when the mouse is not over that window.
- ::SendMessage(view_with_controls->text_field_->GetNativeComponent(),
+ ::SendMessage(view_with_controls->text_field_->GetTestingHandle(),
WM_MOUSEWHEEL, MAKEWPARAM(0, -20), MAKELPARAM(50, 50));
EXPECT_EQ(80, scroll_view->GetVisibleRect().y());
}