Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Unified Diff: third_party/WebKit/Source/core/testing/RecordTest.h

Issue 2709983004: WIP bindings: Add support for the record<K,V> WebIDL type. (Closed)
Patch Set: Rebased patch using NativeValueTraits for IDL types Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/testing/RecordTest.h
diff --git a/third_party/WebKit/Source/core/testing/RecordTest.h b/third_party/WebKit/Source/core/testing/RecordTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..8460295af2c3500dd5f5c4658cce6f4f704eae1c
--- /dev/null
+++ b/third_party/WebKit/Source/core/testing/RecordTest.h
@@ -0,0 +1,70 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef RecordTest_h
+#define RecordTest_h
+
+#include <utility>
+#include "bindings/core/v8/BooleanOrByteStringByteStringRecord.h"
+#include "bindings/core/v8/FloatOrStringBooleanRecord.h"
+#include "bindings/core/v8/FloatOrStringElementRecord.h"
+#include "bindings/core/v8/Nullable.h"
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/dom/Element.h"
+#include "platform/heap/Handle.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+class RecordTest final : public GarbageCollectedFinalized<RecordTest>,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ static RecordTest* create() { return new RecordTest; }
+ ~RecordTest();
+
+ void setStringLongRecord(const Vector<std::pair<String, int32_t>>& arg);
+ Vector<std::pair<String, int32_t>> getStringLongRecord();
+
+ void setNullableStringLongRecord(
+ const Nullable<Vector<std::pair<String, int32_t>>>& arg);
+ Nullable<Vector<std::pair<String, int32_t>>> getNullableStringLongRecord();
+
+ Vector<std::pair<String, String>> getByteStringByteStringRecord();
+ void setByteStringByteStringRecord(
+ const Vector<std::pair<String, String>>& arg);
+
+ void setStringElementRecord(
+ const HeapVector<std::pair<String, Member<Element>>>& arg);
+ HeapVector<std::pair<String, Member<Element>>> getStringElementRecord();
+
+ using NestedRecordType =
+ Vector<std::pair<String, Vector<std::pair<String, bool>>>>;
+ void setUSVStringUSVStringBooleanRecordRecord(const NestedRecordType& arg);
+ NestedRecordType getUSVStringUSVStringBooleanRecordRecord();
+
+ bool unionReceivedARecord(const BooleanOrByteStringByteStringRecord& arg);
+
+ // Test the bindings generator code: unions and dictionaries must trace a
+ // record when it's represented as a HeapVector.
+ void setFloatOrStringBooleanRecord(const FloatOrStringBooleanRecord&){};
+ void setFloatOrStringElementRecord(const FloatOrStringElementRecord&){};
+
+ DECLARE_TRACE();
+
+ private:
+ RecordTest();
+
+ Vector<std::pair<String, int32_t>> m_stringLongRecord;
+ Nullable<Vector<std::pair<String, int32_t>>> m_nullableStringLongRecord;
+ Vector<std::pair<String, String>> m_byteStringByteStringRecord;
+ HeapVector<std::pair<String, Member<Element>>> m_stringElementRecord;
+ NestedRecordType m_USVStringUSVStringBooleanRecordRecord;
+};
+
+} // namespace blink
+
+#endif // RecordTest_h

Powered by Google App Engine
This is Rietveld 408576698