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

Side by Side Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 2379993005: Label selection experiment (Closed)
Patch Set: -- Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); 1492 EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText());
1493 } 1493 }
1494 1494
1495 // This test checks that dragging above the textfield selects to the beginning 1495 // This test checks that dragging above the textfield selects to the beginning
1496 // and dragging below the textfield selects to the end, but only on platforms 1496 // and dragging below the textfield selects to the end, but only on platforms
1497 // where that is the expected behavior. 1497 // where that is the expected behavior.
1498 TEST_F(TextfieldTest, DragUpOrDownSelectsToEnd) { 1498 TEST_F(TextfieldTest, DragUpOrDownSelectsToEnd) {
1499 InitTextfield(); 1499 InitTextfield();
1500 textfield_->SetText(ASCIIToUTF16("hello world")); 1500 textfield_->SetText(ASCIIToUTF16("hello world"));
1501 const base::string16 expected_up = base::ASCIIToUTF16( 1501 const base::string16 expected_up = base::ASCIIToUTF16(
1502 PlatformStyle::kTextfieldDragVerticallyDragsToEnd ? "hello" : "lo"); 1502 PlatformStyle::kTextDragVerticallyDragsToEnd ? "hello" : "lo");
1503 const base::string16 expected_down = base::ASCIIToUTF16( 1503 const base::string16 expected_down = base::ASCIIToUTF16(
1504 PlatformStyle::kTextfieldDragVerticallyDragsToEnd ? " world" : " w"); 1504 PlatformStyle::kTextDragVerticallyDragsToEnd ? " world" : " w");
1505 const int kStartX = GetCursorPositionX(5); 1505 const int kStartX = GetCursorPositionX(5);
1506 const int kDownX = GetCursorPositionX(7); 1506 const int kDownX = GetCursorPositionX(7);
1507 const int kUpX = GetCursorPositionX(3); 1507 const int kUpX = GetCursorPositionX(3);
1508 gfx::Point start_point(kStartX, 0); 1508 gfx::Point start_point(kStartX, 0);
1509 gfx::Point down_point(kDownX, 500); 1509 gfx::Point down_point(kDownX, 500);
1510 gfx::Point up_point(kUpX, -500); 1510 gfx::Point up_point(kUpX, -500);
1511 1511
1512 MoveMouseTo(start_point); 1512 MoveMouseTo(start_point);
1513 PressLeftMouseButton(); 1513 PressLeftMouseButton();
1514 DragMouseTo(up_point); 1514 DragMouseTo(up_point);
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 3005
3006 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 3006 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
3007 ui::AXViewState state_protected; 3007 ui::AXViewState state_protected;
3008 textfield_->GetAccessibleState(&state_protected); 3008 textfield_->GetAccessibleState(&state_protected);
3009 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 3009 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
3010 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 3010 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
3011 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3011 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
3012 } 3012 }
3013 3013
3014 } // namespace views 3014 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698