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

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

Issue 1207973002: Fixes for views_unittests on Mac after InputMethodBridge removal (DO NOT COMMIT) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150625-IMERefactorMac-UPSTREAM
Patch Set: Created 5 years, 6 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
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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/pickle.h" 12 #include "base/pickle.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "ui/accessibility/ax_view_state.h" 15 #include "ui/accessibility/ax_view_state.h"
16 #include "ui/aura/window.h"
17 #include "ui/aura/window_tree_host.h"
18 #include "ui/base/clipboard/clipboard.h" 16 #include "ui/base/clipboard/clipboard.h"
19 #include "ui/base/clipboard/scoped_clipboard_writer.h" 17 #include "ui/base/clipboard/scoped_clipboard_writer.h"
20 #include "ui/base/dragdrop/drag_drop_types.h" 18 #include "ui/base/dragdrop/drag_drop_types.h"
21 #include "ui/base/ime/input_method_base.h" 19 #include "ui/base/ime/input_method_base.h"
22 #include "ui/base/ime/input_method_delegate.h" 20 #include "ui/base/ime/input_method_delegate.h"
23 #include "ui/base/ime/input_method_factory.h" 21 #include "ui/base/ime/input_method_factory.h"
24 #include "ui/base/ime/text_input_client.h" 22 #include "ui/base/ime/text_input_client.h"
25 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/ui_base_switches.h" 24 #include "ui/base/ui_base_switches.h"
27 #include "ui/base/ui_base_switches_util.h" 25 #include "ui/base/ui_base_switches_util.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 textfield_->set_controller(this); 400 textfield_->set_controller(this);
403 widget_ = new Widget(); 401 widget_ = new Widget();
404 402
405 // The widget type must be an activatable type, and we don't want to worry 403 // The widget type must be an activatable type, and we don't want to worry
406 // about the non-client view, which leaves just TYPE_WINDOW_FRAMELESS. 404 // about the non-client view, which leaves just TYPE_WINDOW_FRAMELESS.
407 Widget::InitParams params = 405 Widget::InitParams params =
408 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); 406 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
409 407
410 params.bounds = gfx::Rect(100, 100, 100, 100); 408 params.bounds = gfx::Rect(100, 100, 100, 100);
411 widget_->Init(params); 409 widget_->Init(params);
412 input_method_->SetDelegate(static_cast<ui::internal::InputMethodDelegate*>( 410 input_method_->SetDelegate(
413 widget_->GetNativeWindow()->GetRootWindow()->GetHost())); 411 test::WidgetTest::GetInputMethodDelegateForWidget(widget_));
414 View* container = new View(); 412 View* container = new View();
415 widget_->SetContentsView(container); 413 widget_->SetContentsView(container);
416 container->AddChildView(textfield_); 414 container->AddChildView(textfield_);
417 textfield_->SetBoundsRect(params.bounds); 415 textfield_->SetBoundsRect(params.bounds);
418 textfield_->set_id(1); 416 textfield_->set_id(1);
419 test_api_.reset(new TextfieldTestApi(textfield_)); 417 test_api_.reset(new TextfieldTestApi(textfield_));
420 418
421 for (int i = 1; i < count; i++) { 419 for (int i = 1; i < count; i++) {
422 Textfield* textfield = new Textfield(); 420 Textfield* textfield = new Textfield();
423 container->AddChildView(textfield); 421 container->AddChildView(textfield);
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2539 2537
2540 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 2538 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2541 ui::AXViewState state_protected; 2539 ui::AXViewState state_protected;
2542 textfield_->GetAccessibleState(&state_protected); 2540 textfield_->GetAccessibleState(&state_protected);
2543 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 2541 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
2544 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 2542 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
2545 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 2543 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
2546 } 2544 }
2547 2545
2548 } // namespace views 2546 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698