| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ui/views/payments/validating_textfield.h" | 5 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/ui/views/payments/validation_delegate.h" | 13 #include "chrome/browser/ui/views/payments/validation_delegate.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/views/controls/textfield/textfield.h" | 15 #include "ui/views/controls/textfield/textfield.h" |
| 16 #include "ui/views/test/views_test_base.h" |
| 16 | 17 |
| 17 namespace payments { | 18 namespace payments { |
| 18 | 19 |
| 19 class ValidatingTextfieldTest : public testing::Test { | 20 class ValidatingTextfieldTest : public views::ViewsTestBase { |
| 20 public: | 21 public: |
| 21 ValidatingTextfieldTest() {} | 22 ValidatingTextfieldTest() {} |
| 22 ~ValidatingTextfieldTest() override {} | 23 ~ValidatingTextfieldTest() override {} |
| 23 | 24 |
| 24 protected: | 25 protected: |
| 25 class TestValidationDelegate : public ValidationDelegate { | 26 class TestValidationDelegate : public ValidationDelegate { |
| 26 public: | 27 public: |
| 27 TestValidationDelegate() {} | 28 TestValidationDelegate() {} |
| 28 ~TestValidationDelegate() override {} | 29 ~TestValidationDelegate() override {} |
| 29 | 30 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // On further text adjustements, the validation runs now. Set a valid string | 72 // On further text adjustements, the validation runs now. Set a valid string |
| 72 // (<=5 characters). | 73 // (<=5 characters). |
| 73 textfield->SetText(base::ASCIIToUTF16("good")); | 74 textfield->SetText(base::ASCIIToUTF16("good")); |
| 74 textfield->OnContentsChanged(); | 75 textfield->OnContentsChanged(); |
| 75 | 76 |
| 76 // No longer invalid. | 77 // No longer invalid. |
| 77 EXPECT_FALSE(textfield->invalid()); | 78 EXPECT_FALSE(textfield->invalid()); |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace payments | 81 } // namespace payments |
| OLD | NEW |