| 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..e55b9917c9155a91d36c592da6629a8251f5ac3f 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);
|
| - }
|
| + registerInstallConditionalFeaturesForTests();
|
|
|
| ScriptState* scriptState = ScriptState::from(context);
|
| ScriptState::Scope scope(scriptState);
|
| @@ -123,4 +119,34 @@ void resetInternalsObject(v8::Local<v8::Context> context) {
|
| InternalSettings::from(*page)->resetToConsistentState();
|
| }
|
|
|
| +void installPendingConditionalFeatureForTests(const String& feature,
|
| + const ScriptState* scriptState) {
|
| + (*s_originalInstallPendingConditionalFeatureFunction)(feature, scriptState);
|
| + v8::Local<v8::Object> prototypeObject;
|
| + v8::Local<v8::Function> interfaceObject;
|
| + if (feature == "Frobulate") {
|
| + if (getExistingConstructorAndPrototypeForType(
|
| + &V8OriginTrialsTest::wrapperTypeInfo, scriptState, &prototypeObject,
|
| + &interfaceObject)) {
|
| + V8OriginTrialsTest::installOriginTrialsSampleAPI(
|
| + scriptState->isolate(), scriptState->world(), v8::Local<v8::Object>(),
|
| + prototypeObject, interfaceObject);
|
| + }
|
| + return;
|
| + }
|
| +}
|
| +
|
| +void registerInstallConditionalFeaturesForTests() {
|
| + if (!s_originalInstallConditionalFeaturesFunction) {
|
| + s_originalInstallConditionalFeaturesFunction =
|
| + setInstallConditionalFeaturesFunction(
|
| + installConditionalFeaturesForTests);
|
| + }
|
| + if (!s_originalInstallPendingConditionalFeatureFunction) {
|
| + s_originalInstallPendingConditionalFeatureFunction =
|
| + setInstallPendingConditionalFeatureFunction(
|
| + &installPendingConditionalFeatureForTests);
|
| + }
|
| +}
|
| +
|
| } // namespace WebCoreTestSupport
|
|
|