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

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

Issue 9358049: Implement STYLE_LOWERCASE style for Aura NativeTextfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 9 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
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 EXPECT_STR_EQ("this is a test", model_->GetText()); 354 EXPECT_STR_EQ("this is a test", model_->GetText());
355 EXPECT_STR_EQ("this is a test", textfield_->text()); 355 EXPECT_STR_EQ("this is a test", textfield_->text());
356 EXPECT_TRUE(last_contents_.empty()); 356 EXPECT_TRUE(last_contents_.empty());
357 357
358 EXPECT_EQ(string16(), textfield_->GetSelectedText()); 358 EXPECT_EQ(string16(), textfield_->GetSelectedText());
359 textfield_->SelectAll(); 359 textfield_->SelectAll();
360 EXPECT_STR_EQ("this is a test", textfield_->GetSelectedText()); 360 EXPECT_STR_EQ("this is a test", textfield_->GetSelectedText());
361 EXPECT_TRUE(last_contents_.empty()); 361 EXPECT_TRUE(last_contents_.empty());
362 } 362 }
363 363
364 TEST_F(NativeTextfieldViewsTest, ModelChangesTestLowerCase) {
365 InitTextfield(Textfield::STYLE_LOWERCASE);
366
367 last_contents_.clear();
368 textfield_->SetText(ASCIIToUTF16("THIS IS"));
369
370 EXPECT_STR_EQ("this is", model_->GetText());
371 EXPECT_STR_EQ("THIS IS", textfield_->text());
372 EXPECT_TRUE(last_contents_.empty());
373
374 textfield_->AppendText(ASCIIToUTF16(" A TEST"));
375 EXPECT_STR_EQ("this is a test", model_->GetText());
376 EXPECT_STR_EQ("THIS IS A TEST", textfield_->text());
jungshik at Google 2012/03/26 22:04:34 It'd be nice to have non-ASCII tests here. It'd be
kochi 2012/04/09 06:34:20 Sounds good. I added Japanese test. I left the lo
377 EXPECT_TRUE(last_contents_.empty());
378 }
379
364 TEST_F(NativeTextfieldViewsTest, KeyTest) { 380 TEST_F(NativeTextfieldViewsTest, KeyTest) {
365 InitTextfield(Textfield::STYLE_DEFAULT); 381 InitTextfield(Textfield::STYLE_DEFAULT);
366 SendKeyEvent(ui::VKEY_C, true, false); 382 SendKeyEvent(ui::VKEY_C, true, false);
367 EXPECT_STR_EQ("C", textfield_->text()); 383 EXPECT_STR_EQ("C", textfield_->text());
368 EXPECT_STR_EQ("C", last_contents_); 384 EXPECT_STR_EQ("C", last_contents_);
369 last_contents_.clear(); 385 last_contents_.clear();
370 386
371 SendKeyEvent(ui::VKEY_R, false, false); 387 SendKeyEvent(ui::VKEY_R, false, false);
372 EXPECT_STR_EQ("Cr", textfield_->text()); 388 EXPECT_STR_EQ("Cr", textfield_->text());
373 EXPECT_STR_EQ("Cr", last_contents_); 389 EXPECT_STR_EQ("Cr", last_contents_);
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 #else 1591 #else
1576 EXPECT_EQ(500U, textfield_->GetCursorPosition()); 1592 EXPECT_EQ(500U, textfield_->GetCursorPosition());
1577 #endif 1593 #endif
1578 #endif // !defined(OS_WIN) 1594 #endif // !defined(OS_WIN)
1579 1595
1580 // Reset locale. 1596 // Reset locale.
1581 base::i18n::SetICUDefaultLocale(locale); 1597 base::i18n::SetICUDefaultLocale(locale);
1582 } 1598 }
1583 1599
1584 } // namespace views 1600 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698