Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / bindings / test / TestInterfaceAsyncIterableSingleWithArgs.h
blobb9ef4853b8dfbc0ecd2245bae185ed4cb95cfab7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_TestInterfaceAsyncIterableSingleWithArgs_h
8 #define mozilla_dom_TestInterfaceAsyncIterableSingleWithArgs_h
10 #include "mozilla/dom/TestInterfaceAsyncIterableSingle.h"
12 namespace mozilla::dom {
14 struct TestInterfaceAsyncIteratorOptions;
16 // Implementation of test binding for webidl iterable interfaces, using
17 // primitives for value type
18 class TestInterfaceAsyncIterableSingleWithArgs final
19 : public TestInterfaceAsyncIterableSingle {
20 public:
21 NS_DECL_ISUPPORTS_INHERITED
22 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
23 TestInterfaceAsyncIterableSingleWithArgs,
24 TestInterfaceAsyncIterableSingle)
26 using TestInterfaceAsyncIterableSingle::TestInterfaceAsyncIterableSingle;
27 virtual JSObject* WrapObject(JSContext* aCx,
28 JS::Handle<JSObject*> aGivenProto) override;
29 static already_AddRefed<TestInterfaceAsyncIterableSingleWithArgs> Constructor(
30 const GlobalObject& aGlobal, ErrorResult& rv);
32 using Iterator =
33 AsyncIterableIterator<TestInterfaceAsyncIterableSingleWithArgs>;
35 void InitAsyncIteratorData(IteratorData& aData, Iterator::IteratorType aType,
36 const TestInterfaceAsyncIteratorOptions& aOptions,
37 ErrorResult& aError);
39 already_AddRefed<Promise> GetNextIterationResult(
40 Iterator* aIterator, ErrorResult& aRv) MOZ_CAN_RUN_SCRIPT;
41 already_AddRefed<Promise> IteratorReturn(JSContext* aCx, Iterator* aIterator,
42 JS::Handle<JS::Value> aValue,
43 ErrorResult& aRv) MOZ_CAN_RUN_SCRIPT;
45 uint32_t ReturnCallCount() { return mReturnCallCount; }
46 void GetReturnLastCalledWith(JSContext* aCx,
47 JS::MutableHandle<JS::Value> aReturnCalledWith) {
48 aReturnCalledWith.set(mReturnLastCalledWith);
51 private:
52 ~TestInterfaceAsyncIterableSingleWithArgs() = default;
54 JS::Heap<JS::Value> mReturnLastCalledWith;
55 uint32_t mReturnCallCount = 0;
58 } // namespace mozilla::dom
60 #endif // mozilla_dom_TestInterfaceAsyncIterableSingleWithArgs_h