| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/html/FormData.h" | 6 #include "core/html/FormData.h" |
| 7 | 7 |
| 8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 TEST(FormDataTest, opacityGet) | 12 TEST(FormDataTest, opacityGet) |
| 13 { | 13 { |
| 14 FormData* fd = FormData::create(UTF8Encoding()); | 14 FormData* fd = FormData::create(UTF8Encoding()); |
| 15 fd->append("name1", "value1"); | 15 fd->append("name1", "value1"); |
| 16 | 16 |
| 17 FileOrUSVString result; | 17 FileOrUSVString result; |
| 18 fd->get("name1", result); | 18 fd->get("name1", result); |
| 19 EXPECT_TRUE(result.isUSVString()); | 19 EXPECT_TRUE(result.isUSVString()); |
| 20 EXPECT_EQ("value1", result.getAsUSVString()); | 20 EXPECT_EQ("value1", result.getAsUSVString()); |
| 21 | 21 |
| 22 const FormData::Entry& entry = fd->entries()[0]; | 22 const FormData::Entry& entry = *fd->entries()[0]; |
| 23 EXPECT_STREQ("name1", entry.key().data()); | 23 EXPECT_STREQ("name1", entry.key().data()); |
| 24 EXPECT_STREQ("value1", entry.data().data()); | 24 EXPECT_STREQ("value1", entry.data().data()); |
| 25 | 25 |
| 26 fd->makeOpaque(); | 26 fd->makeOpaque(); |
| 27 | 27 |
| 28 // Web-exposed interface should be opaque. | 28 // Web-exposed interface should be opaque. |
| 29 FileOrUSVString opaqueResult; | 29 FileOrUSVString opaqueResult; |
| 30 fd->get("name1", opaqueResult); | 30 fd->get("name1", opaqueResult); |
| 31 EXPECT_TRUE(opaqueResult.isNull()); | 31 EXPECT_TRUE(opaqueResult.isNull()); |
| 32 | 32 |
| 33 // Internal interface should be uneffected. | 33 // Internal interface should be uneffected. |
| 34 const FormData::Entry& entry2 = fd->entries()[0]; | 34 const FormData::Entry& entry2 = *fd->entries()[0]; |
| 35 EXPECT_STREQ("name1", entry2.key().data()); | 35 EXPECT_STREQ("name1", entry2.key().data()); |
| 36 EXPECT_STREQ("value1", entry2.data().data()); | 36 EXPECT_STREQ("value1", entry2.data().data()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 TEST(FormDataTest, opacityGetAll) | 39 TEST(FormDataTest, opacityGetAll) |
| 40 { | 40 { |
| 41 FormData* fd = FormData::create(UTF8Encoding()); | 41 FormData* fd = FormData::create(UTF8Encoding()); |
| 42 fd->append("name1", "value1"); | 42 fd->append("name1", "value1"); |
| 43 | 43 |
| 44 HeapVector<FormDataEntryValue> results = fd->getAll("name1"); | 44 HeapVector<FormDataEntryValue> results = fd->getAll("name1"); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 69 fd->makeOpaque(); | 69 fd->makeOpaque(); |
| 70 | 70 |
| 71 // Web-exposed interface should be opaque. | 71 // Web-exposed interface should be opaque. |
| 72 EXPECT_FALSE(fd->has("name1")); | 72 EXPECT_FALSE(fd->has("name1")); |
| 73 | 73 |
| 74 // Internal collection should be uneffected. | 74 // Internal collection should be uneffected. |
| 75 EXPECT_EQ(1u, fd->size()); | 75 EXPECT_EQ(1u, fd->size()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace blink | 78 } // namespace blink |
| OLD | NEW |