OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_RIGHT, true); // "H" | 412 model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_RIGHT, true); // "H" |
413 model.ReplaceChar('B'); | 413 model.ReplaceChar('B'); |
414 EXPECT_STR_EQ("BELL", model.GetText()); | 414 EXPECT_STR_EQ("BELL", model.GetText()); |
415 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false); | 415 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false); |
416 model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, true); | 416 model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, true); |
417 model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, true); // "ELL" | 417 model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, true); // "ELL" |
418 model.ReplaceChar('E'); | 418 model.ReplaceChar('E'); |
419 EXPECT_STR_EQ("BEE", model.GetText()); | 419 EXPECT_STR_EQ("BEE", model.GetText()); |
420 } | 420 } |
421 | 421 |
422 TEST_F(TextfieldViewsModelTest, Password) { | 422 TEST_F(TextfieldViewsModelTest, Obscured) { |
423 TextfieldViewsModel model(NULL); | 423 TextfieldViewsModel model(NULL); |
424 model.set_is_password(true); | 424 model.set_is_obscured(true); |
425 model.Append(ASCIIToUTF16("HELLO")); | 425 model.Append(ASCIIToUTF16("HELLO")); |
426 EXPECT_STR_EQ("*****", model.GetVisibleText()); | 426 EXPECT_STR_EQ("*****", model.GetVisibleText()); |
427 EXPECT_STR_EQ("HELLO", model.GetText()); | 427 EXPECT_STR_EQ("HELLO", model.GetText()); |
428 EXPECT_TRUE(model.Delete()); | 428 EXPECT_TRUE(model.Delete()); |
429 | 429 |
430 EXPECT_STR_EQ("****", model.GetVisibleText()); | 430 EXPECT_STR_EQ("****", model.GetVisibleText()); |
431 EXPECT_STR_EQ("ELLO", model.GetText()); | 431 EXPECT_STR_EQ("ELLO", model.GetText()); |
432 EXPECT_EQ(0U, model.GetCursorPosition()); | 432 EXPECT_EQ(0U, model.GetCursorPosition()); |
433 | 433 |
434 model.SelectAll(); | 434 model.SelectAll(); |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 EXPECT_TRUE(model.Undo()); | 1549 EXPECT_TRUE(model.Undo()); |
1550 EXPECT_STR_EQ("ABCDE", model.GetText()); | 1550 EXPECT_STR_EQ("ABCDE", model.GetText()); |
1551 EXPECT_TRUE(model.Redo()); | 1551 EXPECT_TRUE(model.Redo()); |
1552 EXPECT_STR_EQ("1234", model.GetText()); | 1552 EXPECT_STR_EQ("1234", model.GetText()); |
1553 EXPECT_FALSE(model.Redo()); | 1553 EXPECT_FALSE(model.Redo()); |
1554 | 1554 |
1555 // TODO(oshima): We need MockInputMethod to test the behavior with IME. | 1555 // TODO(oshima): We need MockInputMethod to test the behavior with IME. |
1556 } | 1556 } |
1557 | 1557 |
1558 } // namespace views | 1558 } // namespace views |
OLD | NEW |