2015-04-26 20:40:01 +02:00
|
|
|
// Copyright (c) 2015 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 "include/test/cef_translator_test.h"
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTranslatorTestRefPtrLibraryImpl
|
|
|
|
: public CefTranslatorTestRefPtrLibrary {
|
2015-04-26 20:40:01 +02:00
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
explicit CefTranslatorTestRefPtrLibraryImpl(int value) : value_(value) {}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestRefPtrLibraryImpl(
|
|
|
|
const CefTranslatorTestRefPtrLibraryImpl&) = delete;
|
|
|
|
CefTranslatorTestRefPtrLibraryImpl& operator=(
|
|
|
|
const CefTranslatorTestRefPtrLibraryImpl&) = delete;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetValue() override { return value_; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetValue(int value) override { value_ = value; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int value_;
|
|
|
|
|
|
|
|
private:
|
2017-02-07 22:25:11 +01:00
|
|
|
IMPLEMENT_REFCOUNTING(CefTranslatorTestRefPtrLibraryImpl);
|
2015-04-26 20:40:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibrary>
|
|
|
|
CefTranslatorTestRefPtrLibrary::Create(int value) {
|
|
|
|
return new CefTranslatorTestRefPtrLibraryImpl(value);
|
2015-04-26 20:40:01 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTranslatorTestRefPtrLibraryChildImpl
|
|
|
|
: public CefTranslatorTestRefPtrLibraryChild {
|
2015-04-26 20:40:01 +02:00
|
|
|
public:
|
2017-02-07 22:25:11 +01:00
|
|
|
CefTranslatorTestRefPtrLibraryChildImpl(int value, int other_value)
|
2017-05-17 11:29:28 +02:00
|
|
|
: value_(value), other_value_(other_value) {}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestRefPtrLibraryChildImpl(
|
|
|
|
const CefTranslatorTestRefPtrLibraryChildImpl&) = delete;
|
|
|
|
CefTranslatorTestRefPtrLibraryChildImpl& operator=(
|
|
|
|
const CefTranslatorTestRefPtrLibraryChildImpl&) = delete;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetValue() override { return value_; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetValue(int value) override { value_ = value; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetOtherValue() override { return other_value_; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetOtherValue(int value) override { other_value_ = value; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int value_;
|
|
|
|
int other_value_;
|
|
|
|
|
|
|
|
private:
|
2017-02-07 22:25:11 +01:00
|
|
|
IMPLEMENT_REFCOUNTING(CefTranslatorTestRefPtrLibraryChildImpl);
|
2015-04-26 20:40:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibraryChild>
|
2017-05-17 11:29:28 +02:00
|
|
|
CefTranslatorTestRefPtrLibraryChild::Create(int value, int other_value) {
|
2017-02-07 22:25:11 +01:00
|
|
|
return new CefTranslatorTestRefPtrLibraryChildImpl(value, other_value);
|
2015-04-26 20:40:01 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTranslatorTestRefPtrLibraryChildChildImpl
|
|
|
|
: public CefTranslatorTestRefPtrLibraryChildChild {
|
2015-04-26 20:40:01 +02:00
|
|
|
public:
|
2017-02-07 22:25:11 +01:00
|
|
|
CefTranslatorTestRefPtrLibraryChildChildImpl(int value,
|
2017-05-17 11:29:28 +02:00
|
|
|
int other_value,
|
|
|
|
int other_other_value)
|
|
|
|
: value_(value),
|
|
|
|
other_value_(other_value),
|
|
|
|
other_other_value_(other_other_value) {}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestRefPtrLibraryChildChildImpl(
|
|
|
|
const CefTranslatorTestRefPtrLibraryChildChildImpl&) = delete;
|
|
|
|
CefTranslatorTestRefPtrLibraryChildChildImpl& operator=(
|
|
|
|
const CefTranslatorTestRefPtrLibraryChildChildImpl&) = delete;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetValue() override { return value_; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetValue(int value) override { value_ = value; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetOtherValue() override { return other_value_; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetOtherValue(int value) override { other_value_ = value; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetOtherOtherValue() override { return other_other_value_; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetOtherOtherValue(int value) override { other_other_value_ = value; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int value_;
|
|
|
|
int other_value_;
|
|
|
|
int other_other_value_;
|
|
|
|
|
|
|
|
private:
|
2017-02-07 22:25:11 +01:00
|
|
|
IMPLEMENT_REFCOUNTING(CefTranslatorTestRefPtrLibraryChildChildImpl);
|
2015-04-26 20:40:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild>
|
2017-05-17 11:29:28 +02:00
|
|
|
CefTranslatorTestRefPtrLibraryChildChild::Create(int value,
|
|
|
|
int other_value,
|
|
|
|
int other_other_value) {
|
2017-02-07 22:25:11 +01:00
|
|
|
return new CefTranslatorTestRefPtrLibraryChildChildImpl(value, other_value,
|
|
|
|
other_other_value);
|
2015-04-26 20:40:01 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTranslatorTestScopedLibraryImpl
|
|
|
|
: public CefTranslatorTestScopedLibrary {
|
2017-02-07 22:25:11 +01:00
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
explicit CefTranslatorTestScopedLibraryImpl(int value) : value_(value) {}
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestScopedLibraryImpl(
|
|
|
|
const CefTranslatorTestScopedLibraryImpl&) = delete;
|
|
|
|
CefTranslatorTestScopedLibraryImpl& operator=(
|
|
|
|
const CefTranslatorTestScopedLibraryImpl&) = delete;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetValue() override { return value_; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetValue(int value) override { value_ = value; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibrary>
|
|
|
|
CefTranslatorTestScopedLibrary::Create(int value) {
|
|
|
|
return CefOwnPtr<CefTranslatorTestScopedLibrary>(
|
|
|
|
new CefTranslatorTestScopedLibraryImpl(value));
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTranslatorTestScopedLibraryChildImpl
|
|
|
|
: public CefTranslatorTestScopedLibraryChild {
|
2017-02-07 22:25:11 +01:00
|
|
|
public:
|
|
|
|
CefTranslatorTestScopedLibraryChildImpl(int value, int other_value)
|
2017-05-17 11:29:28 +02:00
|
|
|
: value_(value), other_value_(other_value) {}
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestScopedLibraryChildImpl(
|
|
|
|
const CefTranslatorTestScopedLibraryChildImpl&) = delete;
|
|
|
|
CefTranslatorTestScopedLibraryChildImpl& operator=(
|
|
|
|
const CefTranslatorTestScopedLibraryChildImpl&) = delete;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetValue() override { return value_; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetValue(int value) override { value_ = value; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetOtherValue() override { return other_value_; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetOtherValue(int value) override { other_value_ = value; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int value_;
|
|
|
|
int other_value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibraryChild>
|
2017-05-17 11:29:28 +02:00
|
|
|
CefTranslatorTestScopedLibraryChild::Create(int value, int other_value) {
|
2017-02-07 22:25:11 +01:00
|
|
|
return CefOwnPtr<CefTranslatorTestScopedLibraryChild>(
|
|
|
|
new CefTranslatorTestScopedLibraryChildImpl(value, other_value));
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTranslatorTestScopedLibraryChildChildImpl
|
|
|
|
: public CefTranslatorTestScopedLibraryChildChild {
|
2017-02-07 22:25:11 +01:00
|
|
|
public:
|
|
|
|
CefTranslatorTestScopedLibraryChildChildImpl(int value,
|
|
|
|
int other_value,
|
|
|
|
int other_other_value)
|
2017-05-17 11:29:28 +02:00
|
|
|
: value_(value),
|
|
|
|
other_value_(other_value),
|
|
|
|
other_other_value_(other_other_value) {}
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestScopedLibraryChildChildImpl(
|
|
|
|
const CefTranslatorTestScopedLibraryChildChildImpl&) = delete;
|
|
|
|
CefTranslatorTestScopedLibraryChildChildImpl& operator=(
|
|
|
|
const CefTranslatorTestScopedLibraryChildChildImpl&) = delete;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetValue() override { return value_; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetValue(int value) override { value_ = value; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetOtherValue() override { return other_value_; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetOtherValue(int value) override { other_value_ = value; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetOtherOtherValue() override { return other_other_value_; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void SetOtherOtherValue(int value) override { other_other_value_ = value; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int value_;
|
|
|
|
int other_value_;
|
|
|
|
int other_other_value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>
|
2017-05-17 11:29:28 +02:00
|
|
|
CefTranslatorTestScopedLibraryChildChild::Create(int value,
|
|
|
|
int other_value,
|
|
|
|
int other_other_value) {
|
2017-02-07 22:25:11 +01:00
|
|
|
return CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>(
|
|
|
|
new CefTranslatorTestScopedLibraryChildChildImpl(value, other_value,
|
|
|
|
other_other_value));
|
|
|
|
}
|
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
class CefTranslatorTestImpl : public CefTranslatorTest {
|
|
|
|
public:
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTranslatorTestImpl() = default;
|
|
|
|
|
|
|
|
CefTranslatorTestImpl(const CefTranslatorTestImpl&) = delete;
|
|
|
|
CefTranslatorTestImpl& operator=(const CefTranslatorTestImpl&) = delete;
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
// PRIMITIVE VALUES
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void GetVoid() override {}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool GetBool() override { return TEST_BOOL_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int GetInt() override { return TEST_INT_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
double GetDouble() override { return TEST_DOUBLE_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
long GetLong() override { return TEST_LONG_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
size_t GetSizet() override { return TEST_SIZET_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetVoid() override { return true; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetBool(bool val) override { return (val == TEST_BOOL_VAL); }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetInt(int val) override { return (val == TEST_INT_VAL); }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetDouble(double val) override { return (val == TEST_DOUBLE_VAL); }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetLong(long val) override { return (val == TEST_LONG_VAL); }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetSizet(size_t val) override { return (val == TEST_SIZET_VAL); }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
// PRIMITIVE LIST VALUES
|
|
|
|
|
|
|
|
bool SetIntList(const std::vector<int>& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 2U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
return val[0] == TEST_INT_VAL && val[1] == TEST_INT_VAL2;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetIntListByRef(IntList& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != GetIntListSize()) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
val.clear();
|
|
|
|
val.push_back(TEST_INT_VAL);
|
|
|
|
val.push_back(TEST_INT_VAL2);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
size_t GetIntListSize() override { return 2U; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
// STRING VALUES
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
CefString GetString() override { return TEST_STRING_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
bool SetString(const CefString& val) override {
|
|
|
|
return (val.ToString() == TEST_STRING_VAL);
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void GetStringByRef(CefString& val) override { val = TEST_STRING_VAL; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
// STRING LIST VALUES
|
|
|
|
|
|
|
|
bool SetStringList(const std::vector<CefString>& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 3U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2017-05-17 11:29:28 +02:00
|
|
|
return val[0] == TEST_STRING_VAL && val[1] == TEST_STRING_VAL2 &&
|
2015-04-26 20:40:01 +02:00
|
|
|
val[2] == TEST_STRING_VAL3;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetStringListByRef(StringList& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 0U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
val.push_back(TEST_STRING_VAL);
|
|
|
|
val.push_back(TEST_STRING_VAL2);
|
|
|
|
val.push_back(TEST_STRING_VAL3);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// STRING MAP VALUES
|
|
|
|
|
|
|
|
bool SetStringMap(const StringMap& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 3U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
StringMap::const_iterator it;
|
2017-05-17 11:29:28 +02:00
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
it = val.find(TEST_STRING_KEY);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (it == val.end() || it->second != TEST_STRING_VAL) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
it = val.find(TEST_STRING_KEY2);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (it == val.end() || it->second != TEST_STRING_VAL2) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
it = val.find(TEST_STRING_KEY3);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (it == val.end() || it->second != TEST_STRING_VAL3) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetStringMapByRef(std::map<CefString, CefString>& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 0U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
val.insert(std::make_pair(TEST_STRING_KEY, TEST_STRING_VAL));
|
|
|
|
val.insert(std::make_pair(TEST_STRING_KEY2, TEST_STRING_VAL2));
|
|
|
|
val.insert(std::make_pair(TEST_STRING_KEY3, TEST_STRING_VAL3));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// STRING MULTIMAP VALUES
|
|
|
|
|
|
|
|
bool SetStringMultimap(
|
|
|
|
const std::multimap<CefString, CefString>& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 3U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
StringMultimap::const_iterator it;
|
2017-05-17 11:29:28 +02:00
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
it = val.find(TEST_STRING_KEY);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (it == val.end() || it->second != TEST_STRING_VAL) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
it = val.find(TEST_STRING_KEY2);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (it == val.end() || it->second != TEST_STRING_VAL2) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
it = val.find(TEST_STRING_KEY3);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (it == val.end() || it->second != TEST_STRING_VAL3) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetStringMultimapByRef(StringMultimap& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 0U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
val.insert(std::make_pair(TEST_STRING_KEY, TEST_STRING_VAL));
|
|
|
|
val.insert(std::make_pair(TEST_STRING_KEY2, TEST_STRING_VAL2));
|
|
|
|
val.insert(std::make_pair(TEST_STRING_KEY3, TEST_STRING_VAL3));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// STRUCT VALUES
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
CefPoint GetPoint() override { return CefPoint(TEST_X_VAL, TEST_Y_VAL); }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
|
|
|
bool SetPoint(const CefPoint& val) override {
|
|
|
|
return val.x == TEST_X_VAL && val.y == TEST_Y_VAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetPointByRef(CefPoint& val) override {
|
|
|
|
val = CefPoint(TEST_X_VAL, TEST_Y_VAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
// STRUCT LIST VALUES
|
|
|
|
|
|
|
|
bool SetPointList(const std::vector<CefPoint>& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 2U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
return val[0].x == TEST_X_VAL && val[0].y == TEST_Y_VAL &&
|
|
|
|
val[1].x == TEST_X_VAL2 && val[1].y == TEST_Y_VAL2;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetPointListByRef(PointList& val) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != GetPointListSize()) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
val.clear();
|
|
|
|
val.push_back(CefPoint(TEST_X_VAL, TEST_Y_VAL));
|
|
|
|
val.push_back(CefPoint(TEST_X_VAL2, TEST_Y_VAL2));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
size_t GetPointListSize() override { return 2U; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
// LIBRARY-SIDE REFPTR VALUES
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibrary> GetRefPtrLibrary(int val) override {
|
|
|
|
return new CefTranslatorTestRefPtrLibraryChildImpl(val, 0);
|
2015-04-26 20:40:01 +02:00
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
int SetRefPtrLibrary(CefRefPtr<CefTranslatorTestRefPtrLibrary> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibrary> SetRefPtrLibraryAndReturn(
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
int SetChildRefPtrLibrary(
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibrary>
|
|
|
|
SetChildRefPtrLibraryAndReturnParent(
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
// LIBRARY-SIDE REFPTR LIST VALUES
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
bool SetRefPtrLibraryList(
|
2017-05-17 11:29:28 +02:00
|
|
|
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary>>& val,
|
|
|
|
int val1,
|
|
|
|
int val2) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 2U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool GetRefPtrLibraryListByRef(RefPtrLibraryList& val,
|
|
|
|
int val1,
|
2017-02-07 22:25:11 +01:00
|
|
|
int val2) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != GetRefPtrLibraryListSize()) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
val.clear();
|
2017-02-07 22:25:11 +01:00
|
|
|
val.push_back(new CefTranslatorTestRefPtrLibraryChildImpl(val1, 0));
|
|
|
|
val.push_back(new CefTranslatorTestRefPtrLibraryImpl(val2));
|
2015-04-26 20:40:01 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
size_t GetRefPtrLibraryListSize() override { return 2U; }
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
// CLIENT-SIDE REFPTR VALUES
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
int SetRefPtrClient(CefRefPtr<CefTranslatorTestRefPtrClient> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClient> SetRefPtrClientAndReturn(
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClient> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
int SetChildRefPtrClient(
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClient> SetChildRefPtrClientAndReturnParent(
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) override {
|
2015-04-26 20:40:01 +02:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
// CLIENT-SIDE REFPTR LIST VALUES
|
2015-04-26 20:40:01 +02:00
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
bool SetRefPtrClientList(
|
2017-05-17 11:29:28 +02:00
|
|
|
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient>>& val,
|
|
|
|
int val1,
|
|
|
|
int val2) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 2U) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
|
|
|
}
|
|
|
|
|
2017-02-07 22:25:11 +01:00
|
|
|
bool GetRefPtrClientListByRef(
|
|
|
|
RefPtrClientList& val,
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClient> val1,
|
|
|
|
CefRefPtr<CefTranslatorTestRefPtrClient> val2) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != GetRefPtrClientListSize()) {
|
2015-04-26 20:40:01 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-04-26 20:40:01 +02:00
|
|
|
val.clear();
|
|
|
|
val.push_back(val1);
|
|
|
|
val.push_back(val2);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
size_t GetRefPtrClientListSize() override { return 2U; }
|
2017-02-07 22:25:11 +01:00
|
|
|
|
|
|
|
// LIBRARY-SIDE OWNPTR VALUES
|
|
|
|
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibrary> GetOwnPtrLibrary(int val) override {
|
|
|
|
return CefOwnPtr<CefTranslatorTestScopedLibrary>(
|
|
|
|
new CefTranslatorTestScopedLibraryChildImpl(val, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
int SetOwnPtrLibrary(CefOwnPtr<CefTranslatorTestScopedLibrary> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibrary> SetOwnPtrLibraryAndReturn(
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibrary> val) override {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SetChildOwnPtrLibrary(
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibrary>
|
|
|
|
SetChildOwnPtrLibraryAndReturnParent(
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) override {
|
|
|
|
return CefOwnPtr<CefTranslatorTestScopedLibrary>(val.release());
|
|
|
|
}
|
|
|
|
|
|
|
|
// CLIENT-SIDE OWNPTR VALUES
|
|
|
|
|
|
|
|
int SetOwnPtrClient(CefOwnPtr<CefTranslatorTestScopedClient> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedClient> SetOwnPtrClientAndReturn(
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedClient> val) override {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SetChildOwnPtrClient(
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedClientChild> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedClient> SetChildOwnPtrClientAndReturnParent(
|
|
|
|
CefOwnPtr<CefTranslatorTestScopedClientChild> val) override {
|
|
|
|
return CefOwnPtr<CefTranslatorTestScopedClient>(val.release());
|
|
|
|
}
|
|
|
|
|
|
|
|
// LIBRARY-SIDE RAWPTR VALUES
|
|
|
|
|
|
|
|
int SetRawPtrLibrary(CefRawPtr<CefTranslatorTestScopedLibrary> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
int SetChildRawPtrLibrary(
|
|
|
|
CefRawPtr<CefTranslatorTestScopedLibraryChild> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
// LIBRARY-SIDE RAWPTR LIST VALUES
|
|
|
|
|
|
|
|
bool SetRawPtrLibraryList(
|
2017-05-17 11:29:28 +02:00
|
|
|
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary>>& val,
|
|
|
|
int val1,
|
|
|
|
int val2) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 2U) {
|
2017-02-07 22:25:11 +01:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2017-02-07 22:25:11 +01:00
|
|
|
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CLIENT-SIDE RAWPTR VALUES
|
|
|
|
|
|
|
|
int SetRawPtrClient(CefRawPtr<CefTranslatorTestScopedClient> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
int SetChildRawPtrClient(
|
|
|
|
CefRawPtr<CefTranslatorTestScopedClientChild> val) override {
|
|
|
|
return val->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
// CLIENT-SIDE RAWPTR LIST VALUES
|
|
|
|
|
|
|
|
bool SetRawPtrClientList(
|
2017-05-17 11:29:28 +02:00
|
|
|
const std::vector<CefRawPtr<CefTranslatorTestScopedClient>>& val,
|
|
|
|
int val1,
|
|
|
|
int val2) override {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (val.size() != 2U) {
|
2017-02-07 22:25:11 +01:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2017-02-07 22:25:11 +01:00
|
|
|
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
|
|
|
}
|
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
private:
|
|
|
|
IMPLEMENT_REFCOUNTING(CefTranslatorTestImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefRefPtr<CefTranslatorTest> CefTranslatorTest::Create() {
|
|
|
|
return new CefTranslatorTestImpl();
|
|
|
|
}
|