| OLD | NEW |
| 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 <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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 506 |
| 507 // Cut on obscured (password) text should do nothing. | 507 // Cut on obscured (password) text should do nothing. |
| 508 model.render_text()->SetObscured(true); | 508 model.render_text()->SetObscured(true); |
| 509 model.SelectAll(false); | 509 model.SelectAll(false); |
| 510 EXPECT_FALSE(model.Cut()); | 510 EXPECT_FALSE(model.Cut()); |
| 511 clipboard->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &clipboard_text); | 511 clipboard->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &clipboard_text); |
| 512 EXPECT_EQ(initial_clipboard_text, clipboard_text); | 512 EXPECT_EQ(initial_clipboard_text, clipboard_text); |
| 513 EXPECT_STR_EQ("HELLO WORLD", model.text()); | 513 EXPECT_STR_EQ("HELLO WORLD", model.text()); |
| 514 EXPECT_STR_EQ("HELLO WORLD", model.GetSelectedText()); | 514 EXPECT_STR_EQ("HELLO WORLD", model.GetSelectedText()); |
| 515 | 515 |
| 516 // Copy on obscured text should do nothing. | 516 // Copy on obscured (password) text should do nothing. |
| 517 model.SelectAll(false); | 517 model.SelectAll(false); |
| 518 EXPECT_FALSE(model.Copy()); | 518 EXPECT_FALSE(model.Copy()); |
| 519 clipboard->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &clipboard_text); | 519 clipboard->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &clipboard_text); |
| 520 EXPECT_EQ(initial_clipboard_text, clipboard_text); | 520 EXPECT_EQ(initial_clipboard_text, clipboard_text); |
| 521 EXPECT_STR_EQ("HELLO WORLD", model.text()); | 521 EXPECT_STR_EQ("HELLO WORLD", model.text()); |
| 522 EXPECT_STR_EQ("HELLO WORLD", model.GetSelectedText()); | 522 EXPECT_STR_EQ("HELLO WORLD", model.GetSelectedText()); |
| 523 | 523 |
| 524 // Cut with non-empty selection. | 524 // Cut with non-empty selection. |
| 525 model.render_text()->SetObscured(false); | 525 model.render_text()->SetObscured(false); |
| 526 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false); | 526 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false); |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 EXPECT_TRUE(model.Undo()); | 1507 EXPECT_TRUE(model.Undo()); |
| 1508 EXPECT_STR_EQ("ABCDE", model.text()); | 1508 EXPECT_STR_EQ("ABCDE", model.text()); |
| 1509 EXPECT_TRUE(model.Redo()); | 1509 EXPECT_TRUE(model.Redo()); |
| 1510 EXPECT_STR_EQ("1234", model.text()); | 1510 EXPECT_STR_EQ("1234", model.text()); |
| 1511 EXPECT_FALSE(model.Redo()); | 1511 EXPECT_FALSE(model.Redo()); |
| 1512 | 1512 |
| 1513 // TODO(oshima): We need MockInputMethod to test the behavior with IME. | 1513 // TODO(oshima): We need MockInputMethod to test the behavior with IME. |
| 1514 } | 1514 } |
| 1515 | 1515 |
| 1516 } // namespace views | 1516 } // namespace views |
| OLD | NEW |