| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/autofill/browser/autofill_data_model.h" | |
| 6 | |
| 7 #include "base/compiler_specific.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace autofill { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 // Provides concrete implementations for pure virtual methods. | |
| 15 class TestAutofillDataModel : public AutofillDataModel { | |
| 16 public: | |
| 17 TestAutofillDataModel(const std::string& guid, const std::string& origin) | |
| 18 : AutofillDataModel(guid, origin) {} | |
| 19 virtual ~TestAutofillDataModel() {} | |
| 20 | |
| 21 private: | |
| 22 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE { | |
| 23 return base::string16(); | |
| 24 } | |
| 25 virtual void SetRawInfo(AutofillFieldType type, | |
| 26 const base::string16& value) OVERRIDE {} | |
| 27 virtual void GetSupportedTypes( | |
| 28 FieldTypeSet* supported_types) const OVERRIDE {} | |
| 29 virtual void FillFormField(const AutofillField& field, | |
| 30 size_t variant, | |
| 31 const std::string& app_locale, | |
| 32 FormFieldData* field_data) const OVERRIDE {} | |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(TestAutofillDataModel); | |
| 35 }; | |
| 36 | |
| 37 } // namespace | |
| 38 | |
| 39 TEST(AutofillDataModelTest, IsVerified) { | |
| 40 TestAutofillDataModel model("guid", std::string()); | |
| 41 EXPECT_FALSE(model.IsVerified()); | |
| 42 | |
| 43 model.set_origin("http://www.example.com"); | |
| 44 EXPECT_FALSE(model.IsVerified()); | |
| 45 | |
| 46 model.set_origin("https://www.example.com"); | |
| 47 EXPECT_FALSE(model.IsVerified()); | |
| 48 | |
| 49 model.set_origin("file:///tmp/example.txt"); | |
| 50 EXPECT_FALSE(model.IsVerified()); | |
| 51 | |
| 52 model.set_origin("data:text/plain;charset=utf-8;base64,ZXhhbXBsZQ=="); | |
| 53 EXPECT_FALSE(model.IsVerified()); | |
| 54 | |
| 55 model.set_origin("chrome://settings/autofill"); | |
| 56 EXPECT_FALSE(model.IsVerified()); | |
| 57 | |
| 58 model.set_origin("Chrome Settings"); | |
| 59 EXPECT_TRUE(model.IsVerified()); | |
| 60 | |
| 61 model.set_origin("Some gibberish string"); | |
| 62 EXPECT_TRUE(model.IsVerified()); | |
| 63 | |
| 64 model.set_origin(std::string()); | |
| 65 EXPECT_FALSE(model.IsVerified()); | |
| 66 } | |
| 67 | |
| 68 } // namespace autofill | |
| OLD | NEW |