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

Side by Side Diff: chrome/browser/chromeos/input_method/textinput_test_helper.cc

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h" 10 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 ui::TextInputClient* TextInputTestHelper::GetTextInputClient() const { 70 ui::TextInputClient* TextInputTestHelper::GetTextInputClient() const {
71 return GetInputMethod()->GetTextInputClient(); 71 return GetInputMethod()->GetTextInputClient();
72 } 72 }
73 73
74 void TextInputTestHelper::OnTextInputTypeChanged( 74 void TextInputTestHelper::OnTextInputTypeChanged(
75 const ui::TextInputClient* client) { 75 const ui::TextInputClient* client) {
76 latest_text_input_type_ = 76 latest_text_input_type_ =
77 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; 77 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE;
78 if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED) 78 if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED)
79 base::MessageLoop::current()->Quit(); 79 base::MessageLoop::current()->QuitWhenIdle();
80 } 80 }
81 81
82 void TextInputTestHelper::OnShowImeIfNeeded() { 82 void TextInputTestHelper::OnShowImeIfNeeded() {
83 } 83 }
84 84
85 void TextInputTestHelper::OnInputMethodDestroyed( 85 void TextInputTestHelper::OnInputMethodDestroyed(
86 const ui::InputMethod* input_method) { 86 const ui::InputMethod* input_method) {
87 } 87 }
88 88
89 void TextInputTestHelper::OnFocus() { 89 void TextInputTestHelper::OnFocus() {
90 focus_state_ = true; 90 focus_state_ = true;
91 if (waiting_type_ == WAIT_ON_FOCUS) 91 if (waiting_type_ == WAIT_ON_FOCUS)
92 base::MessageLoop::current()->Quit(); 92 base::MessageLoop::current()->QuitWhenIdle();
93 } 93 }
94 94
95 void TextInputTestHelper::OnBlur() { 95 void TextInputTestHelper::OnBlur() {
96 focus_state_ = false; 96 focus_state_ = false;
97 if (waiting_type_ == WAIT_ON_BLUR) 97 if (waiting_type_ == WAIT_ON_BLUR)
98 base::MessageLoop::current()->Quit(); 98 base::MessageLoop::current()->QuitWhenIdle();
99 } 99 }
100 100
101 void TextInputTestHelper::OnCaretBoundsChanged( 101 void TextInputTestHelper::OnCaretBoundsChanged(
102 const ui::TextInputClient* client) { 102 const ui::TextInputClient* client) {
103 gfx::Range text_range; 103 gfx::Range text_range;
104 if (GetTextInputClient()) { 104 if (GetTextInputClient()) {
105 if (!GetTextInputClient()->GetTextRange(&text_range) || 105 if (!GetTextInputClient()->GetTextRange(&text_range) ||
106 !GetTextInputClient()->GetTextFromRange(text_range, 106 !GetTextInputClient()->GetTextFromRange(text_range,
107 &surrounding_text_) || 107 &surrounding_text_) ||
108 !GetTextInputClient()->GetSelectionRange(&selection_range_)) 108 !GetTextInputClient()->GetSelectionRange(&selection_range_))
109 return; 109 return;
110 } 110 }
111 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) 111 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED)
112 base::MessageLoop::current()->Quit(); 112 base::MessageLoop::current()->QuitWhenIdle();
113 } 113 }
114 114
115 void TextInputTestHelper::OnTextInputStateChanged( 115 void TextInputTestHelper::OnTextInputStateChanged(
116 const ui::TextInputClient* client) { 116 const ui::TextInputClient* client) {
117 } 117 }
118 118
119 void TextInputTestHelper::WaitForTextInputStateChanged( 119 void TextInputTestHelper::WaitForTextInputStateChanged(
120 ui::TextInputType expected_type) { 120 ui::TextInputType expected_type) {
121 CHECK_EQ(NO_WAIT, waiting_type_); 121 CHECK_EQ(NO_WAIT, waiting_type_);
122 waiting_type_ = WAIT_ON_TEXT_INPUT_TYPE_CHANGED; 122 waiting_type_ = WAIT_ON_TEXT_INPUT_TYPE_CHANGED;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 mouse_event.y = rect.CenterPoint().y(); 202 mouse_event.y = rect.CenterPoint().y();
203 mouse_event.clickCount = 1; 203 mouse_event.clickCount = 1;
204 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 204 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
205 205
206 mouse_event.type = blink::WebInputEvent::MouseUp; 206 mouse_event.type = blink::WebInputEvent::MouseUp;
207 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 207 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
208 return true; 208 return true;
209 } 209 }
210 210
211 } // namespace chromeos 211 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698