mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix duplicate entries in CefRequest header map (issue #1840)
This commit is contained in:
@@ -8,11 +8,15 @@
|
||||
#include "tests/unittests/test_util.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
void TestMapEqual(CefRequest::HeaderMap& map1,
|
||||
CefRequest::HeaderMap& map2,
|
||||
void TestMapEqual(const CefRequest::HeaderMap& map1,
|
||||
const CefRequest::HeaderMap& map2,
|
||||
bool allowExtras) {
|
||||
if (!allowExtras)
|
||||
EXPECT_EQ(map1.size(), map2.size());
|
||||
|
||||
TestMapNoDuplicates(map1);
|
||||
TestMapNoDuplicates(map2);
|
||||
|
||||
CefRequest::HeaderMap::const_iterator it1, it2;
|
||||
|
||||
for (it1 = map1.begin(); it1 != map1.end(); ++it1) {
|
||||
@@ -25,6 +29,17 @@ void TestMapEqual(CefRequest::HeaderMap& map1,
|
||||
}
|
||||
}
|
||||
|
||||
void TestMapNoDuplicates(const CefRequest::HeaderMap& map) {
|
||||
CefRequest::HeaderMap::const_iterator it1 = map.begin();
|
||||
for (; it1 != map.end(); ++it1) {
|
||||
CefRequest::HeaderMap::const_iterator it2 = it1;
|
||||
for (++it2; it2 != map.end(); ++it2) {
|
||||
EXPECT_FALSE(it1->first == it2->first && it1->second == it2->second) <<
|
||||
"Duplicate entry for " << it1->first << ": " << it1->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestPostDataElementEqual(CefRefPtr<CefPostDataElement> elem1,
|
||||
CefRefPtr<CefPostDataElement> elem2) {
|
||||
EXPECT_TRUE(elem1.get());
|
||||
|
Reference in New Issue
Block a user