2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
2014-07-15 00:18:51 +02:00
|
|
|
|
|
|
|
// Include this first to avoid type conflicts with CEF headers.
|
|
|
|
#include "tests/unittests/chromium_includes.h"
|
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
#include "include/base/cef_string16.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "include/internal/cef_string.h"
|
|
|
|
#include "include/internal/cef_string_list.h"
|
|
|
|
#include "include/internal/cef_string_map.h"
|
|
|
|
#include "include/internal/cef_string_multimap.h"
|
|
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
|
|
|
|
// Test UTF8 strings.
|
|
|
|
TEST(StringTest, UTF8) {
|
|
|
|
CefStringUTF8 str1("Test String");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1.length(), (size_t)11);
|
|
|
|
EXPECT_FALSE(str1.empty());
|
|
|
|
EXPECT_TRUE(str1.IsOwner());
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test equality.
|
|
|
|
CefStringUTF8 str2("Test String");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
|
|
|
EXPECT_LE(str1, str2);
|
|
|
|
EXPECT_GE(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
str2 = "Test Test";
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_LT(str1, str2);
|
|
|
|
EXPECT_GT(str2, str1);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// When strings are the same but of unequal length, the longer string is
|
|
|
|
// greater.
|
|
|
|
str2 = "Test";
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_LT(str2, str1);
|
|
|
|
EXPECT_GT(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test conversions.
|
|
|
|
str2 = str1.ToString();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
str2 = str1.ToWString();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test userfree assignment.
|
|
|
|
cef_string_userfree_utf8_t uf = str2.DetachToUserFree();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(uf != NULL);
|
|
|
|
EXPECT_TRUE(str2.empty());
|
2012-04-03 03:34:16 +02:00
|
|
|
str2.AttachToUserFree(uf);
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_FALSE(str2.empty());
|
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Test UTF16 strings.
|
|
|
|
TEST(StringTest, UTF16) {
|
|
|
|
CefStringUTF16 str1("Test String");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1.length(), (size_t)11);
|
|
|
|
EXPECT_FALSE(str1.empty());
|
|
|
|
EXPECT_TRUE(str1.IsOwner());
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test equality.
|
|
|
|
CefStringUTF16 str2("Test String");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
|
|
|
EXPECT_LE(str1, str2);
|
|
|
|
EXPECT_GE(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
str2 = "Test Test";
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_LT(str1, str2);
|
|
|
|
EXPECT_GT(str2, str1);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// When strings are the same but of unequal length, the longer string is
|
|
|
|
// greater.
|
|
|
|
str2 = "Test";
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_LT(str2, str1);
|
|
|
|
EXPECT_GT(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test conversions.
|
|
|
|
str2 = str1.ToString();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
str2 = str1.ToWString();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test userfree assignment.
|
|
|
|
cef_string_userfree_utf16_t uf = str2.DetachToUserFree();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(uf != NULL);
|
|
|
|
EXPECT_TRUE(str2.empty());
|
2012-04-03 03:34:16 +02:00
|
|
|
str2.AttachToUserFree(uf);
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_FALSE(str2.empty());
|
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Test wide strings.
|
|
|
|
TEST(StringTest, Wide) {
|
|
|
|
CefStringWide str1("Test String");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1.length(), (size_t)11);
|
|
|
|
EXPECT_FALSE(str1.empty());
|
|
|
|
EXPECT_TRUE(str1.IsOwner());
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test equality.
|
|
|
|
CefStringWide str2("Test String");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
|
|
|
EXPECT_LE(str1, str2);
|
|
|
|
EXPECT_GE(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
str2 = "Test Test";
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_LT(str1, str2);
|
|
|
|
EXPECT_GT(str2, str1);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// When strings are the same but of unequal length, the longer string is
|
|
|
|
// greater.
|
|
|
|
str2 = "Test";
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_LT(str2, str1);
|
|
|
|
EXPECT_GT(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test conversions.
|
|
|
|
str2 = str1.ToString();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
str2 = str1.ToWString();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(str1, str2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Test userfree assignment.
|
|
|
|
cef_string_userfree_wide_t uf = str2.DetachToUserFree();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(uf != NULL);
|
|
|
|
EXPECT_TRUE(str2.empty());
|
2012-04-03 03:34:16 +02:00
|
|
|
str2.AttachToUserFree(uf);
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_FALSE(str2.empty());
|
|
|
|
EXPECT_EQ(str1, str2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test base::string16 convertion to/from CefString types.
|
|
|
|
TEST(StringTest, string16) {
|
|
|
|
CefStringUTF8 str8("Test String 1"), str8b;
|
|
|
|
CefStringUTF16 str16("Test String 2"), str16b;
|
|
|
|
CefStringWide strwide("Test String 3"), strwideb;
|
|
|
|
base::string16 base_str;
|
|
|
|
|
|
|
|
base_str = str8;
|
|
|
|
str8b = base_str;
|
|
|
|
EXPECT_EQ(str8, base_str);
|
|
|
|
EXPECT_EQ(str8, str8b);
|
|
|
|
|
|
|
|
base_str = str16;
|
|
|
|
str16b = base_str;
|
|
|
|
EXPECT_EQ(str16, base_str);
|
|
|
|
EXPECT_EQ(str16, str16b);
|
|
|
|
|
|
|
|
base_str = strwide;
|
|
|
|
strwideb = base_str;
|
|
|
|
EXPECT_EQ(strwide, base_str);
|
|
|
|
EXPECT_EQ(strwide, strwideb);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Test string lists.
|
|
|
|
TEST(StringTest, List) {
|
|
|
|
typedef std::vector<CefString> ListType;
|
|
|
|
ListType list;
|
|
|
|
list.push_back("String 1");
|
|
|
|
list.push_back("String 2");
|
|
|
|
list.push_back("String 3");
|
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(list[0], "String 1");
|
|
|
|
EXPECT_EQ(list[1], "String 2");
|
|
|
|
EXPECT_EQ(list[2], "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_list_t listPtr = cef_string_list_alloc();
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(listPtr != NULL);
|
2012-04-03 03:34:16 +02:00
|
|
|
ListType::const_iterator it = list.begin();
|
|
|
|
for (; it != list.end(); ++it)
|
|
|
|
cef_string_list_append(listPtr, it->GetStruct());
|
|
|
|
|
|
|
|
CefString str;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_list_size(listPtr), 3);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_list_value(listPtr, 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 1");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_list_value(listPtr, 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_list_value(listPtr, 2, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_list_t listPtr2 = cef_string_list_copy(listPtr);
|
|
|
|
cef_string_list_clear(listPtr);
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_list_size(listPtr), 0);
|
2012-04-03 03:34:16 +02:00
|
|
|
cef_string_list_free(listPtr);
|
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_list_size(listPtr2), 3);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_list_value(listPtr2, 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 1");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_list_value(listPtr2, 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_list_value(listPtr2, 2, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_list_free(listPtr2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test string maps.
|
|
|
|
TEST(StringTest, Map) {
|
|
|
|
typedef std::map<CefString, CefString> MapType;
|
|
|
|
MapType map;
|
|
|
|
map.insert(std::make_pair("Key 1", "String 1"));
|
|
|
|
map.insert(std::make_pair("Key 2", "String 2"));
|
|
|
|
map.insert(std::make_pair("Key 3", "String 3"));
|
|
|
|
|
|
|
|
MapType::const_iterator it;
|
|
|
|
|
|
|
|
it = map.find("Key 2");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(it != map.end());
|
|
|
|
EXPECT_EQ(it->first, "Key 2");
|
|
|
|
EXPECT_EQ(it->second, "String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
it = map.find(L"Key 2");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(it != map.end());
|
|
|
|
EXPECT_EQ(it->first, L"Key 2");
|
|
|
|
EXPECT_EQ(it->second, L"String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(map["Key 1"], "String 1");
|
|
|
|
EXPECT_EQ(map["Key 2"], "String 2");
|
|
|
|
EXPECT_EQ(map["Key 3"], "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_map_t mapPtr = cef_string_map_alloc();
|
|
|
|
|
|
|
|
it = map.begin();
|
|
|
|
for (; it != map.end(); ++it) {
|
|
|
|
cef_string_map_append(mapPtr, it->first.GetStruct(),
|
|
|
|
it->second.GetStruct());
|
|
|
|
}
|
|
|
|
|
|
|
|
CefString str;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_map_size(mapPtr), 3);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_map_key(mapPtr, 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 1");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_map_value(mapPtr, 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 1");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_map_key(mapPtr, 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_map_value(mapPtr, 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_map_key(mapPtr, 2, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_map_value(mapPtr, 2, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
CefString key;
|
|
|
|
key.FromASCII("Key 2");
|
|
|
|
ret = cef_string_map_find(mapPtr, key.GetStruct(), str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_map_clear(mapPtr);
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_map_size(mapPtr), 0);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_map_free(mapPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test string maps.
|
|
|
|
TEST(StringTest, Multimap) {
|
|
|
|
typedef std::multimap<CefString, CefString> MapType;
|
|
|
|
MapType map;
|
|
|
|
map.insert(std::make_pair("Key 1", "String 1"));
|
|
|
|
map.insert(std::make_pair("Key 2", "String 2"));
|
|
|
|
map.insert(std::make_pair("Key 2", "String 2.1"));
|
|
|
|
map.insert(std::make_pair("Key 3", "String 3"));
|
|
|
|
|
|
|
|
MapType::const_iterator it;
|
|
|
|
|
|
|
|
it = map.find("Key 2");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(it != map.end());
|
|
|
|
EXPECT_EQ(it->first, "Key 2");
|
|
|
|
EXPECT_EQ(it->second, "String 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
std::pair<MapType::const_iterator, MapType::const_iterator>
|
|
|
|
range_it = map.equal_range("Key 2");
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(range_it.first != range_it.second);
|
2012-04-03 03:34:16 +02:00
|
|
|
MapType::const_iterator same_key_it = range_it.first;
|
|
|
|
// Either of "String 2" or "String 2.1" is fine since
|
|
|
|
// std::multimap provides no guarantee wrt the order of
|
|
|
|
// values with the same key.
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(same_key_it->second.ToString().find("String 2"), (size_t)0);
|
|
|
|
EXPECT_EQ((++same_key_it)->second.ToString().find("String 2"), (size_t)0);
|
|
|
|
EXPECT_EQ(map.count("Key 2"), (size_t)2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(map.find("Key 1")->second, "String 1");
|
|
|
|
EXPECT_EQ(map.find("Key 3")->second, "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_multimap_t mapPtr = cef_string_multimap_alloc();
|
|
|
|
|
|
|
|
it = map.begin();
|
|
|
|
for (; it != map.end(); ++it) {
|
|
|
|
cef_string_multimap_append(mapPtr, it->first.GetStruct(),
|
|
|
|
it->second.GetStruct());
|
|
|
|
}
|
|
|
|
|
|
|
|
CefString str;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_multimap_size(mapPtr), 4);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_multimap_key(mapPtr, 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 1");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_multimap_value(mapPtr, 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 1");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_multimap_key(mapPtr, 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_multimap_value(mapPtr, 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str.ToString().find("String 2"), (size_t)0);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_multimap_key(mapPtr, 2, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 2");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_multimap_value(mapPtr, 2, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str.ToString().find("String 2"), (size_t)0);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_multimap_key(mapPtr, 3, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "Key 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
ret = cef_string_multimap_value(mapPtr, 3, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str, "String 3");
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
CefString key;
|
|
|
|
key.FromASCII("Key 2");
|
|
|
|
ret = cef_string_multimap_find_count(mapPtr, key.GetStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(ret, 2);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_multimap_enumerate(mapPtr,
|
|
|
|
key.GetStruct(), 0, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str.ToString().find("String 2"), (size_t)0);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
ret = cef_string_multimap_enumerate(mapPtr,
|
|
|
|
key.GetStruct(), 1, str.GetWritableStruct());
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_TRUE(ret);
|
|
|
|
EXPECT_EQ(str.ToString().find("String 2"), (size_t)0);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_multimap_clear(mapPtr);
|
2014-07-16 00:07:25 +02:00
|
|
|
EXPECT_EQ(cef_string_multimap_size(mapPtr), 0);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
cef_string_multimap_free(mapPtr);
|
|
|
|
}
|