#include "third_party/blink/renderer/bindings/core/v8/script_promise_property.h"
#include <memory>
#include "base/memory/scoped_refptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "third_party/blink/renderer/core/testing/garbage_collected_script_wrappable.h"
#include "third_party/blink/renderer/core/testing/gc_observation.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
class NotReachedFunction : public ScriptFunction::Callable { … };
ScriptValue NotReachedFunction::Call(ScriptState*, ScriptValue) { … }
class StubFunction : public ScriptFunction::Callable { … };
class GarbageCollectedHolder final : public GarbageCollectedScriptWrappable { … };
class ScriptPromisePropertyResetter : public ScriptFunction::Callable { … };
class ScriptPromisePropertyTestBase { … };
class ScriptPromisePropertyGarbageCollectedTest
: public ScriptPromisePropertyTestBase,
public testing::Test { … };
class ScriptPromisePropertyNonScriptWrappableResolutionTargetTest
: public ScriptPromisePropertyTestBase,
public testing::Test { … };
}
TEST_F(ScriptPromisePropertyGarbageCollectedTest,
Promise_IsStableObjectInMainWorld) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest,
Promise_IsStableObjectInVariousWorlds) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest,
Promise_IsStableObjectAfterSettling) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest,
Promise_DoesNotImpedeGarbageCollection) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest,
Resolve_ResolvesScriptPromise) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest,
ResolveAndGetPromiseOnOtherWorld) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reject_RejectsScriptPromise) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_DeadContext) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_DeadContext) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reset) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest, MarkAsHandled) { … }
TEST_F(ScriptPromisePropertyGarbageCollectedTest, SyncResolve) { … }
TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest,
ResolveWithUndefined) { … }
TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest,
ResolveWithString) { … }
TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest,
ResolveWithInteger) { … }
}