summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_utils_unittest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-18 16:18:07 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-18 23:29:38 +0000
commit3420ba852babe24c7b03fede1b3b7c474c148c0d (patch)
treecd89ec87588122fbe5eee4646dedd05aec6589c2 /xfa/fxfa/parser/xfa_utils_unittest.cpp
parentac07d340069e2f6e50d1e9aeae7140ce4d20a7de (diff)
downloadpdfium-3420ba852babe24c7b03fede1b3b7c474c148c0d.tar.xz
Remove hand-written bsearch from XFA_GetAttributeByName()
Also fix potential for collisions by checking exact name. Change-Id: I48cd609d28a23f738f7a6c946820a688a4163024 Reviewed-on: https://pdfium-review.googlesource.com/4314 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_utils_unittest.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_utils_unittest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/xfa_utils_unittest.cpp b/xfa/fxfa/parser/xfa_utils_unittest.cpp
index e4dd09419e..1898a797ec 100644
--- a/xfa/fxfa/parser/xfa_utils_unittest.cpp
+++ b/xfa/fxfa/parser/xfa_utils_unittest.cpp
@@ -273,3 +273,12 @@ TEST_F(XFANodeIteratorTest, ChildAsRootNext) {
EXPECT_EQ(child6(), iter.MoveToNext());
EXPECT_EQ(nullptr, iter.MoveToNext());
}
+
+TEST(XFAUtilsTest, GetAttributeByName) {
+ EXPECT_EQ(nullptr, XFA_GetAttributeByName(L""));
+ EXPECT_EQ(nullptr, XFA_GetAttributeByName(L"clams"));
+ EXPECT_EQ(XFA_ATTRIBUTE_H, XFA_GetAttributeByName(L"h")->eName);
+ EXPECT_EQ(XFA_ATTRIBUTE_Short, XFA_GetAttributeByName(L"short")->eName);
+ EXPECT_EQ(XFA_ATTRIBUTE_DecipherOnly,
+ XFA_GetAttributeByName(L"decipherOnly")->eName);
+}