| Index: third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
|
| diff --git a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
|
| index 21b58cfbd8d30466cb51a28c9159402012daf3a8..0af370d63e8156724dec74f9398ff13a95ed3ebe 100644
|
| --- a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
|
| +++ b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
|
| @@ -45,6 +45,8 @@ namespace {
|
|
|
| blink::InstallConditionalFeaturesFunction
|
| s_originalInstallConditionalFeaturesFunction = nullptr;
|
| +blink::InstallPendingConditionalFeatureFunction
|
| + s_originalInstallPendingConditionalFeatureFunction = nullptr;
|
|
|
| v8::Local<v8::Value> createInternalsObject(v8::Local<v8::Context> context) {
|
| ScriptState* scriptState = ScriptState::from(context);
|
| @@ -61,13 +63,7 @@ v8::Local<v8::Value> createInternalsObject(v8::Local<v8::Context> context) {
|
| }
|
|
|
| void injectInternalsObject(v8::Local<v8::Context> context) {
|
| - // Set conditional features installation function to
|
| - // |installConditionalFeaturesForTests|
|
| - if (!s_originalInstallConditionalFeaturesFunction) {
|
| - s_originalInstallConditionalFeaturesFunction =
|
| - setInstallConditionalFeaturesFunction(
|
| - installConditionalFeaturesForTests);
|
| - }
|
| + registerInstallConditionalFeaturesForTesting();
|
|
|
| ScriptState* scriptState = ScriptState::from(context);
|
| ScriptState::Scope scope(scriptState);
|
| @@ -82,8 +78,8 @@ void injectInternalsObject(v8::Local<v8::Context> context) {
|
| .ToChecked();
|
| }
|
|
|
| -void installConditionalFeaturesForTests(
|
| - const WrapperTypeInfo* type,
|
| +void installConditionalFeaturesForTesting(
|
| + const blink::WrapperTypeInfo* type,
|
| const blink::ScriptState* scriptState,
|
| v8::Local<v8::Object> prototypeObject,
|
| v8::Local<v8::Function> interfaceObject) {
|
| @@ -123,4 +119,36 @@ void resetInternalsObject(v8::Local<v8::Context> context) {
|
| InternalSettings::from(*page)->resetToConsistentState();
|
| }
|
|
|
| +void installPendingConditionalFeatureForTesting(
|
| + const String& feature,
|
| + const blink::ScriptState* scriptState) {
|
| + (*s_originalInstallPendingConditionalFeatureFunction)(feature, scriptState);
|
| + v8::Local<v8::Object> prototypeObject;
|
| + v8::Local<v8::Function> interfaceObject;
|
| + if (feature == "Frobulate") {
|
| + if (scriptState->perContextData()
|
| + ->getExistingConstructorAndPrototypeForType(
|
| + &blink::V8OriginTrialsTest::wrapperTypeInfo, &prototypeObject,
|
| + &interfaceObject)) {
|
| + blink::V8OriginTrialsTest::installOriginTrialsSampleAPI(
|
| + scriptState->isolate(), scriptState->world(), v8::Local<v8::Object>(),
|
| + prototypeObject, interfaceObject);
|
| + }
|
| + return;
|
| + }
|
| +}
|
| +
|
| +void registerInstallConditionalFeaturesForTesting() {
|
| + if (!s_originalInstallConditionalFeaturesFunction) {
|
| + s_originalInstallConditionalFeaturesFunction =
|
| + setInstallConditionalFeaturesFunction(
|
| + installConditionalFeaturesForTesting);
|
| + }
|
| + if (!s_originalInstallPendingConditionalFeatureFunction) {
|
| + s_originalInstallPendingConditionalFeatureFunction =
|
| + setInstallPendingConditionalFeatureFunction(
|
| + &installPendingConditionalFeatureForTesting);
|
| + }
|
| +}
|
| +
|
| } // namespace WebCoreTestSupport
|
|
|