| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 | 890 |
| 891 Widget* widget = new Widget; | 891 Widget* widget = new Widget; |
| 892 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 892 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
| 893 params.bounds = gfx::Rect(0, 0, 100, 100); | 893 params.bounds = gfx::Rect(0, 0, 100, 100); |
| 894 widget->Init(params); | 894 widget->Init(params); |
| 895 View* root_view = widget->GetRootView(); | 895 View* root_view = widget->GetRootView(); |
| 896 | 896 |
| 897 Textfield* normal = new Textfield(); | 897 Textfield* normal = new Textfield(); |
| 898 Textfield* read_only = new Textfield(); | 898 Textfield* read_only = new Textfield(); |
| 899 read_only->SetReadOnly(true); | 899 read_only->SetReadOnly(true); |
| 900 Textfield* password = new Textfield(Textfield::STYLE_PASSWORD); | 900 Textfield* password = new Textfield(Textfield::STYLE_OBSCURED); |
| 901 | 901 |
| 902 root_view->AddChildView(normal); | 902 root_view->AddChildView(normal); |
| 903 root_view->AddChildView(read_only); | 903 root_view->AddChildView(read_only); |
| 904 root_view->AddChildView(password); | 904 root_view->AddChildView(password); |
| 905 | 905 |
| 906 normal->SetText(kNormalText); | 906 normal->SetText(kNormalText); |
| 907 read_only->SetText(kReadOnlyText); | 907 read_only->SetText(kReadOnlyText); |
| 908 password->SetText(kPasswordText); | 908 password->SetText(kPasswordText); |
| 909 | 909 |
| 910 // | 910 // |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 normal->SelectAll(); | 950 normal->SelectAll(); |
| 951 ::SendMessage(normal->GetTestingHandle(), WM_COPY, 0, 0); | 951 ::SendMessage(normal->GetTestingHandle(), WM_COPY, 0, 0); |
| 952 result.clear(); | 952 result.clear(); |
| 953 clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); | 953 clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); |
| 954 EXPECT_EQ(kNormalText, result); | 954 EXPECT_EQ(kNormalText, result); |
| 955 | 955 |
| 956 password->SelectAll(); | 956 password->SelectAll(); |
| 957 ::SendMessage(password->GetTestingHandle(), WM_COPY, 0, 0); | 957 ::SendMessage(password->GetTestingHandle(), WM_COPY, 0, 0); |
| 958 result.clear(); | 958 result.clear(); |
| 959 clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); | 959 clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); |
| 960 // We don't let you copy from a password field, clipboard should not have | 960 // We don't let you copy from an obscured field, clipboard should not have |
| 961 // changed. | 961 // changed. |
| 962 EXPECT_EQ(kNormalText, result); | 962 EXPECT_EQ(kNormalText, result); |
| 963 | 963 |
| 964 // | 964 // |
| 965 // Test Paste. | 965 // Test Paste. |
| 966 // | 966 // |
| 967 // Note that we use GetWindowText instead of Textfield::GetText below as the | 967 // Note that we use GetWindowText instead of Textfield::GetText below as the |
| 968 // text in the Textfield class is synced to the text of the HWND on | 968 // text in the Textfield class is synced to the text of the HWND on |
| 969 // WM_KEYDOWN messages that we are not simulating here. | 969 // WM_KEYDOWN messages that we are not simulating here. |
| 970 | 970 |
| (...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 // Move c1 to the front. The layers should have moved too. | 3127 // Move c1 to the front. The layers should have moved too. |
| 3128 content->ReorderChildView(c1, -1); | 3128 content->ReorderChildView(c1, -1); |
| 3129 EXPECT_EQ(c1->layer(), parent_layer->children()[1]); | 3129 EXPECT_EQ(c1->layer(), parent_layer->children()[1]); |
| 3130 EXPECT_EQ(c2->layer(), parent_layer->children()[0]); | 3130 EXPECT_EQ(c2->layer(), parent_layer->children()[0]); |
| 3131 } | 3131 } |
| 3132 #endif | 3132 #endif |
| 3133 | 3133 |
| 3134 #endif // VIEWS_COMPOSITOR | 3134 #endif // VIEWS_COMPOSITOR |
| 3135 | 3135 |
| 3136 } // namespace views | 3136 } // namespace views |
| OLD | NEW |