summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc')
-rw-r--r--chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc93
1 files changed, 46 insertions, 47 deletions
diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc
index fe9cdf6bb5b..78033a0d104 100644
--- a/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc
+++ b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc
@@ -4,12 +4,12 @@
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
-#include "third_party/blink/renderer/bindings/core/v8/file_or_usv_string_or_form_data.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_address_space.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_create_html_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_point_init.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_listener.h"
+#include "third_party/blink/renderer/bindings/core/v8/v8_union_file_formdata_usvstring.h"
#include "third_party/blink/renderer/core/dom/events/event_target.h"
#include "third_party/blink/renderer/core/streams/stream_promise_resolver.h"
#include "third_party/blink/renderer/core/testing/garbage_collected_script_wrappable.h"
@@ -144,52 +144,51 @@ TEST(ToV8TraitsTest, String) {
const String string("string");
const char* const charptr_string = "charptrString";
// ByteString
- TEST_TOV8_TRAITS(scope, IDLByteStringV2, "string", string);
- TEST_TOV8_TRAITS(scope, IDLByteStringV2, "charptrString", charptr_string);
+ TEST_TOV8_TRAITS(scope, IDLByteString, "string", string);
+ TEST_TOV8_TRAITS(scope, IDLByteString, "charptrString", charptr_string);
// DOMString
- TEST_TOV8_TRAITS(scope, IDLStringV2, "string", string);
- TEST_TOV8_TRAITS(scope, IDLStringV2, "charptrString", charptr_string);
- TEST_TOV8_TRAITS(scope, IDLStringTreatNullAsEmptyStringV2, "string", string);
- TEST_TOV8_TRAITS(scope, IDLStringTreatNullAsEmptyStringV2, "charptrString",
+ TEST_TOV8_TRAITS(scope, IDLString, "string", string);
+ TEST_TOV8_TRAITS(scope, IDLString, "charptrString", charptr_string);
+ TEST_TOV8_TRAITS(scope, IDLStringTreatNullAsEmptyString, "string", string);
+ TEST_TOV8_TRAITS(scope, IDLStringTreatNullAsEmptyString, "charptrString",
charptr_string);
// USVString
- TEST_TOV8_TRAITS(scope, IDLUSVStringV2, "string", string);
- TEST_TOV8_TRAITS(scope, IDLUSVStringV2, "charptrString", charptr_string);
+ TEST_TOV8_TRAITS(scope, IDLUSVString, "string", string);
+ TEST_TOV8_TRAITS(scope, IDLUSVString, "charptrString", charptr_string);
// [StringContext=TrustedHTML] DOMString
- TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedHTMLV2, "string",
- string);
- TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedHTMLV2, "charptrString",
+ TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedHTML, "string", string);
+ TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedHTML, "charptrString",
charptr_string);
TEST_TOV8_TRAITS(scope,
- IDLStringStringContextTrustedHTMLTreatNullAsEmptyStringV2,
+ IDLStringStringContextTrustedHTMLTreatNullAsEmptyString,
"string", string);
TEST_TOV8_TRAITS(scope,
- IDLStringStringContextTrustedHTMLTreatNullAsEmptyStringV2,
+ IDLStringStringContextTrustedHTMLTreatNullAsEmptyString,
"charptrString", charptr_string);
// [StringContext=TrustedScript] DOMString
- TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedScriptV2, "string",
+ TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedScript, "string",
string);
- TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedScriptV2,
- "charptrString", charptr_string);
+ TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedScript, "charptrString",
+ charptr_string);
TEST_TOV8_TRAITS(scope,
- IDLStringStringContextTrustedScriptTreatNullAsEmptyStringV2,
+ IDLStringStringContextTrustedScriptTreatNullAsEmptyString,
"string", string);
TEST_TOV8_TRAITS(scope,
- IDLStringStringContextTrustedScriptTreatNullAsEmptyStringV2,
+ IDLStringStringContextTrustedScriptTreatNullAsEmptyString,
"charptrString", charptr_string);
// [StringContext=TrustedScriptURL] USVString
- TEST_TOV8_TRAITS(scope, IDLUSVStringStringContextTrustedScriptURLV2, "string",
+ TEST_TOV8_TRAITS(scope, IDLUSVStringStringContextTrustedScriptURL, "string",
string);
- TEST_TOV8_TRAITS(scope, IDLUSVStringStringContextTrustedScriptURLV2,
+ TEST_TOV8_TRAITS(scope, IDLUSVStringStringContextTrustedScriptURL,
"charptrString", charptr_string);
}
TEST(ToV8TraitsTest, EmptyString) {
const V8TestingScope scope;
const String empty_string("");
- TEST_TOV8_TRAITS(scope, IDLStringV2, "", empty_string);
+ TEST_TOV8_TRAITS(scope, IDLString, "", empty_string);
const char* const empty = "";
- TEST_TOV8_TRAITS(scope, IDLStringV2, "", empty);
+ TEST_TOV8_TRAITS(scope, IDLString, "", empty);
}
TEST(ToV8TraitsTest, Object) {
@@ -198,7 +197,7 @@ TEST(ToV8TraitsTest, Object) {
string_vector.push_back("hello");
string_vector.push_back("world");
ScriptValue value(scope.GetIsolate(),
- ToV8Traits<IDLSequence<IDLStringV2>>::ToV8(
+ ToV8Traits<IDLSequence<IDLString>>::ToV8(
scope.GetScriptState(), string_vector));
TEST_TOV8_TRAITS(scope, IDLObject, "hello,world", value);
v8::Local<v8::Value> actual;
@@ -237,7 +236,7 @@ TEST(ToV8TraitsTest, Vector) {
Vector<String> string_vector;
string_vector.push_back("foo");
string_vector.push_back("bar");
- TEST_TOV8_TRAITS(scope, IDLSequence<IDLStringV2>, "foo,bar", string_vector);
+ TEST_TOV8_TRAITS(scope, IDLSequence<IDLString>, "foo,bar", string_vector);
}
TEST(ToV8TraitsTest, HeapVector) {
@@ -317,11 +316,11 @@ TEST(ToV8TraitsTest, StringVectorVector) {
compound_vector.push_back(string_vector2);
EXPECT_EQ(2U, compound_vector.size());
- TEST_TOV8_TRAITS(scope, IDLSequence<IDLSequence<IDLStringV2>>, "foo,bar,quux",
+ TEST_TOV8_TRAITS(scope, IDLSequence<IDLSequence<IDLString>>, "foo,bar,quux",
compound_vector);
v8::Local<v8::Value> actual;
- ASSERT_TRUE(ToV8Traits<IDLSequence<IDLSequence<IDLStringV2>>>::ToV8(
+ ASSERT_TRUE(ToV8Traits<IDLSequence<IDLSequence<IDLString>>>::ToV8(
scope.GetScriptState(), compound_vector)
.ToLocal(&actual))
<< "ToV8 throws an exception.";
@@ -394,7 +393,7 @@ TEST(ToV8TraitsTest, PairVector) {
Vector<std::pair<String, int8_t>> pair_vector;
pair_vector.push_back(std::make_pair("one", 1));
pair_vector.push_back(std::make_pair("two", 2));
- using ByteRecord = IDLRecord<IDLStringV2, IDLByte>;
+ using ByteRecord = IDLRecord<IDLString, IDLByte>;
TEST_TOV8_TRAITS(scope, ByteRecord, "[object Object]", pair_vector);
v8::Local<v8::Value> actual;
ASSERT_TRUE(ToV8Traits<ByteRecord>::ToV8(scope.GetScriptState(), pair_vector)
@@ -420,7 +419,7 @@ TEST(ToV8TraitsTest, PairHeapVector) {
"one", MakeGarbageCollected<GarbageCollectedScriptWrappable>("foo")));
pair_heap_vector.push_back(std::make_pair(
"two", MakeGarbageCollected<GarbageCollectedScriptWrappable>("bar")));
- using HeapRecord = IDLRecord<IDLStringV2, GarbageCollectedScriptWrappable>;
+ using HeapRecord = IDLRecord<IDLString, GarbageCollectedScriptWrappable>;
TEST_TOV8_TRAITS(scope, HeapRecord, "[object Object]", pair_heap_vector);
v8::Local<v8::Value> actual;
ASSERT_TRUE(
@@ -451,9 +450,9 @@ TEST(ToV8TraitsTest, PairHeapVector) {
TEST(ToV8TraitsTest, NullStringInputForNoneNullableType) {
const V8TestingScope scope;
const String null_string;
- TEST_TOV8_TRAITS(scope, IDLStringV2, "", null_string);
+ TEST_TOV8_TRAITS(scope, IDLString, "", null_string);
const char* const null = nullptr;
- TEST_TOV8_TRAITS(scope, IDLStringV2, "", null);
+ TEST_TOV8_TRAITS(scope, IDLString, "", null);
}
TEST(ToV8TraitsTest, Nullable) {
@@ -477,16 +476,16 @@ TEST(ToV8TraitsTest, Nullable) {
TEST(ToV8TraitsTest, NullableString) {
const V8TestingScope scope;
- TEST_TOV8_TRAITS(scope, IDLNullable<IDLStringV2>, "null", String());
- TEST_TOV8_TRAITS(scope, IDLNullable<IDLStringV2>, "string", String("string"));
- TEST_TOV8_TRAITS(scope, IDLNullable<IDLStringV2>, "", String(""));
+ TEST_TOV8_TRAITS(scope, IDLNullable<IDLString>, "null", String());
+ TEST_TOV8_TRAITS(scope, IDLNullable<IDLString>, "string", String("string"));
+ TEST_TOV8_TRAITS(scope, IDLNullable<IDLString>, "", String(""));
const char* const null = nullptr;
- TEST_TOV8_TRAITS(scope, IDLNullable<IDLStringV2>, "null", null);
+ TEST_TOV8_TRAITS(scope, IDLNullable<IDLString>, "null", null);
const char* const charptr_string = "charptrString";
- TEST_TOV8_TRAITS(scope, IDLNullable<IDLStringV2>, "charptrString",
+ TEST_TOV8_TRAITS(scope, IDLNullable<IDLString>, "charptrString",
charptr_string);
const char* const charptr_empty_string = "";
- TEST_TOV8_TRAITS(scope, IDLNullable<IDLStringV2>, "", charptr_empty_string);
+ TEST_TOV8_TRAITS(scope, IDLNullable<IDLString>, "", charptr_empty_string);
}
TEST(ToV8TraitsTest, NullableObject) {
@@ -592,21 +591,21 @@ TEST(ToV8TraitsTest, NullableDate) {
TEST(ToV8TraitsTest, Union) {
const V8TestingScope scope;
- const FileOrUSVStringOrFormData usv_string =
- FileOrUSVStringOrFormData::FromUSVString("https://example.com/");
- TEST_TOV8_TRAITS(scope, IDLUnionNotINT<FileOrUSVStringOrFormData>,
+ const auto* usv_string =
+ MakeGarbageCollected<V8UnionFileOrFormDataOrUSVString>(
+ "https://example.com/");
+ TEST_TOV8_TRAITS(scope, V8UnionFileOrFormDataOrUSVString,
"https://example.com/", usv_string);
}
TEST(ToV8TraitsTest, NullableUnion) {
const V8TestingScope scope;
- TEST_TOV8_TRAITS(scope,
- IDLNullable<IDLUnionNotINT<FileOrUSVStringOrFormData>>,
- "null", FileOrUSVStringOrFormData());
- const FileOrUSVStringOrFormData usv_string =
- FileOrUSVStringOrFormData::FromUSVString("http://example.com/");
- TEST_TOV8_TRAITS(scope,
- IDLNullable<IDLUnionNotINT<FileOrUSVStringOrFormData>>,
+ TEST_TOV8_TRAITS(scope, IDLNullable<V8UnionFileOrFormDataOrUSVString>, "null",
+ nullptr);
+ const auto* usv_string =
+ MakeGarbageCollected<V8UnionFileOrFormDataOrUSVString>(
+ "http://example.com/");
+ TEST_TOV8_TRAITS(scope, IDLNullable<V8UnionFileOrFormDataOrUSVString>,
"http://example.com/", usv_string);
}