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

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

Issue 10109001: Replace all LOGs in input_method/, except two user-facing errors, to DVLOG(1). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/input_method/xkeyboard.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chromeos/input_method/xkeyboard.h" 5 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // The 1st kVoidKey should be ignored. 190 // The 1st kVoidKey should be ignored.
191 GetMap(kVoidKey, kVoidKey, kVoidKey)).c_str()); 191 GetMap(kVoidKey, kVoidKey, kVoidKey)).c_str());
192 EXPECT_STREQ("de(neo)+chromeos(search_leftcontrol_leftcontrol_keepralt)", 192 EXPECT_STREQ("de(neo)+chromeos(search_leftcontrol_leftcontrol_keepralt)",
193 xkey_->CreateFullXkbLayoutName( 193 xkey_->CreateFullXkbLayoutName(
194 // The 1st kLeftControlKey should be ignored. 194 // The 1st kLeftControlKey should be ignored.
195 "de(neo)", GetMap(kLeftControlKey, 195 "de(neo)", GetMap(kLeftControlKey,
196 kLeftControlKey, 196 kLeftControlKey,
197 kLeftControlKey)).c_str()); 197 kLeftControlKey)).c_str());
198 EXPECT_STREQ("gb(extd)+chromeos(disabled_disabled_disabled_keepralt)", 198 EXPECT_STREQ("gb(extd)+chromeos(disabled_disabled_disabled_keepralt)",
199 xkey_->CreateFullXkbLayoutName( 199 xkey_->CreateFullXkbLayoutName(
200 "gb(extd)", 200 "gb(extd)",
201 GetMap(kVoidKey, kVoidKey, kVoidKey)).c_str()); 201 GetMap(kVoidKey, kVoidKey, kVoidKey)).c_str());
202 } 202 }
203 203
204 TEST_F(XKeyboardTest, TestCreateFullXkbLayoutNameKeepAlt) { 204 TEST_F(XKeyboardTest, TestCreateFullXkbLayoutNameKeepAlt) {
205 EXPECT_STREQ("us(intl)+chromeos(disabled_disabled_disabled_keepralt)", 205 EXPECT_STREQ("us(intl)+chromeos(disabled_disabled_disabled_keepralt)",
206 xkey_->CreateFullXkbLayoutName( 206 xkey_->CreateFullXkbLayoutName(
207 "us(intl)", GetMap(kVoidKey, kVoidKey, kVoidKey)).c_str()); 207 "us(intl)", GetMap(kVoidKey, kVoidKey, kVoidKey)).c_str());
208 EXPECT_STREQ("kr(kr104)+" 208 EXPECT_STREQ("kr(kr104)+"
209 "chromeos(leftcontrol_leftcontrol_leftcontrol_keepralt)", 209 "chromeos(leftcontrol_leftcontrol_leftcontrol_keepralt)",
210 xkey_->CreateFullXkbLayoutName( 210 xkey_->CreateFullXkbLayoutName(
211 "kr(kr104)", GetMap(kLeftControlKey, 211 "kr(kr104)", GetMap(kLeftControlKey,
(...skipping 18 matching lines...) Expand all
230 } 230 }
231 } 231 }
232 } 232 }
233 } 233 }
234 234
235 TEST_F(XKeyboardTest, TestSetCapsLockEnabled) { 235 TEST_F(XKeyboardTest, TestSetCapsLockEnabled) {
236 if (!DisplayAvailable()) { 236 if (!DisplayAvailable()) {
237 // Do not fail the test to allow developers to run unit_tests without an X 237 // Do not fail the test to allow developers to run unit_tests without an X
238 // server (e.g. via ssh). Note that both try bots and waterfall always have 238 // server (e.g. via ssh). Note that both try bots and waterfall always have
239 // an X server for running browser_tests. 239 // an X server for running browser_tests.
240 LOG(INFO) << "X server is not available. Skip the test."; 240 DVLOG(1) << "X server is not available. Skip the test.";
241 return; 241 return;
242 } 242 }
243 const bool initial_lock_state = xkey_->CapsLockIsEnabled(); 243 const bool initial_lock_state = xkey_->CapsLockIsEnabled();
244 xkey_->SetCapsLockEnabled(true); 244 xkey_->SetCapsLockEnabled(true);
245 EXPECT_TRUE(xkey_->CapsLockIsEnabled()); 245 EXPECT_TRUE(xkey_->CapsLockIsEnabled());
246 xkey_->SetCapsLockEnabled(false); 246 xkey_->SetCapsLockEnabled(false);
247 EXPECT_FALSE(xkey_->CapsLockIsEnabled()); 247 EXPECT_FALSE(xkey_->CapsLockIsEnabled());
248 xkey_->SetCapsLockEnabled(true); 248 xkey_->SetCapsLockEnabled(true);
249 EXPECT_TRUE(xkey_->CapsLockIsEnabled()); 249 EXPECT_TRUE(xkey_->CapsLockIsEnabled());
250 xkey_->SetCapsLockEnabled(false); 250 xkey_->SetCapsLockEnabled(false);
251 EXPECT_FALSE(xkey_->CapsLockIsEnabled()); 251 EXPECT_FALSE(xkey_->CapsLockIsEnabled());
252 xkey_->SetCapsLockEnabled(initial_lock_state); 252 xkey_->SetCapsLockEnabled(initial_lock_state);
253 } 253 }
254 254
255 TEST_F(XKeyboardTest, TestSetNumLockEnabled) { 255 TEST_F(XKeyboardTest, TestSetNumLockEnabled) {
256 if (!DisplayAvailable()) { 256 if (!DisplayAvailable()) {
257 LOG(INFO) << "X server is not available. Skip the test."; 257 DVLOG(1) << "X server is not available. Skip the test.";
258 return; 258 return;
259 } 259 }
260 const unsigned int num_lock_mask = xkey_->GetNumLockMask(); 260 const unsigned int num_lock_mask = xkey_->GetNumLockMask();
261 ASSERT_NE(0U, num_lock_mask); 261 ASSERT_NE(0U, num_lock_mask);
262 262
263 const bool initial_lock_state = xkey_->NumLockIsEnabled(); 263 const bool initial_lock_state = xkey_->NumLockIsEnabled();
264 xkey_->SetNumLockEnabled(true); 264 xkey_->SetNumLockEnabled(true);
265 EXPECT_TRUE(xkey_->NumLockIsEnabled()); 265 EXPECT_TRUE(xkey_->NumLockIsEnabled());
266 xkey_->SetNumLockEnabled(false); 266 xkey_->SetNumLockEnabled(false);
267 EXPECT_FALSE(xkey_->NumLockIsEnabled()); 267 EXPECT_FALSE(xkey_->NumLockIsEnabled());
268 xkey_->SetNumLockEnabled(true); 268 xkey_->SetNumLockEnabled(true);
269 EXPECT_TRUE(xkey_->NumLockIsEnabled()); 269 EXPECT_TRUE(xkey_->NumLockIsEnabled());
270 xkey_->SetNumLockEnabled(false); 270 xkey_->SetNumLockEnabled(false);
271 EXPECT_FALSE(xkey_->NumLockIsEnabled()); 271 EXPECT_FALSE(xkey_->NumLockIsEnabled());
272 xkey_->SetNumLockEnabled(initial_lock_state); 272 xkey_->SetNumLockEnabled(initial_lock_state);
273 } 273 }
274 274
275 TEST_F(XKeyboardTest, TestSetCapsLockAndNumLockAtTheSameTime) { 275 TEST_F(XKeyboardTest, TestSetCapsLockAndNumLockAtTheSameTime) {
276 if (!DisplayAvailable()) { 276 if (!DisplayAvailable()) {
277 LOG(INFO) << "X server is not available. Skip the test."; 277 DVLOG(1) << "X server is not available. Skip the test.";
278 return; 278 return;
279 } 279 }
280 const unsigned int num_lock_mask = xkey_->GetNumLockMask(); 280 const unsigned int num_lock_mask = xkey_->GetNumLockMask();
281 ASSERT_NE(0U, num_lock_mask); 281 ASSERT_NE(0U, num_lock_mask);
282 282
283 const bool initial_caps_lock_state = xkey_->CapsLockIsEnabled(); 283 const bool initial_caps_lock_state = xkey_->CapsLockIsEnabled();
284 const bool initial_num_lock_state = xkey_->NumLockIsEnabled(); 284 const bool initial_num_lock_state = xkey_->NumLockIsEnabled();
285 285
286 // Flip both. 286 // Flip both.
287 xkey_->SetLockedModifiers( 287 xkey_->SetLockedModifiers(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 EXPECT_TRUE(XKeyboard::ContainsModifierKeyAsReplacement( 343 EXPECT_TRUE(XKeyboard::ContainsModifierKeyAsReplacement(
344 GetMap(kCapsLockKey, kCapsLockKey, kVoidKey), kCapsLockKey)); 344 GetMap(kCapsLockKey, kCapsLockKey, kVoidKey), kCapsLockKey));
345 EXPECT_TRUE(XKeyboard::ContainsModifierKeyAsReplacement( 345 EXPECT_TRUE(XKeyboard::ContainsModifierKeyAsReplacement(
346 GetMap(kCapsLockKey, kCapsLockKey, kCapsLockKey), kCapsLockKey)); 346 GetMap(kCapsLockKey, kCapsLockKey, kCapsLockKey), kCapsLockKey));
347 EXPECT_TRUE(XKeyboard::ContainsModifierKeyAsReplacement( 347 EXPECT_TRUE(XKeyboard::ContainsModifierKeyAsReplacement(
348 GetMap(kSearchKey, kVoidKey, kVoidKey), kSearchKey)); 348 GetMap(kSearchKey, kVoidKey, kVoidKey), kSearchKey));
349 } 349 }
350 350
351 TEST_F(XKeyboardTest, TestSetAutoRepeatEnabled) { 351 TEST_F(XKeyboardTest, TestSetAutoRepeatEnabled) {
352 if (!DisplayAvailable()) { 352 if (!DisplayAvailable()) {
353 LOG(INFO) << "X server is not available. Skip the test."; 353 DVLOG(1) << "X server is not available. Skip the test.";
354 return; 354 return;
355 } 355 }
356 const bool state = XKeyboard::GetAutoRepeatEnabledForTesting(); 356 const bool state = XKeyboard::GetAutoRepeatEnabledForTesting();
357 XKeyboard::SetAutoRepeatEnabled(!state); 357 XKeyboard::SetAutoRepeatEnabled(!state);
358 EXPECT_EQ(!state, XKeyboard::GetAutoRepeatEnabledForTesting()); 358 EXPECT_EQ(!state, XKeyboard::GetAutoRepeatEnabledForTesting());
359 // Restore the initial state. 359 // Restore the initial state.
360 XKeyboard::SetAutoRepeatEnabled(state); 360 XKeyboard::SetAutoRepeatEnabled(state);
361 EXPECT_EQ(state, XKeyboard::GetAutoRepeatEnabledForTesting()); 361 EXPECT_EQ(state, XKeyboard::GetAutoRepeatEnabledForTesting());
362 } 362 }
363 363
364 TEST_F(XKeyboardTest, TestSetAutoRepeatRate) { 364 TEST_F(XKeyboardTest, TestSetAutoRepeatRate) {
365 if (!DisplayAvailable()) { 365 if (!DisplayAvailable()) {
366 LOG(INFO) << "X server is not available. Skip the test."; 366 DVLOG(1) << "X server is not available. Skip the test.";
367 return; 367 return;
368 } 368 }
369 AutoRepeatRate rate; 369 AutoRepeatRate rate;
370 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&rate)); 370 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&rate));
371 371
372 AutoRepeatRate tmp(rate); 372 AutoRepeatRate tmp(rate);
373 ++tmp.initial_delay_in_ms; 373 ++tmp.initial_delay_in_ms;
374 ++tmp.repeat_interval_in_ms; 374 ++tmp.repeat_interval_in_ms;
375 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(tmp)); 375 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(tmp));
376 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp)); 376 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp));
377 EXPECT_EQ(rate.initial_delay_in_ms + 1, tmp.initial_delay_in_ms); 377 EXPECT_EQ(rate.initial_delay_in_ms + 1, tmp.initial_delay_in_ms);
378 EXPECT_EQ(rate.repeat_interval_in_ms + 1, tmp.repeat_interval_in_ms); 378 EXPECT_EQ(rate.repeat_interval_in_ms + 1, tmp.repeat_interval_in_ms);
379 379
380 // Restore the initial state. 380 // Restore the initial state.
381 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(rate)); 381 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(rate));
382 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp)); 382 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp));
383 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); 383 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms);
384 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); 384 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms);
385 } 385 }
386 386
387 } // namespace input_method 387 } // namespace input_method
388 } // namespace chromeos 388 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/xkeyboard.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698