| 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 600adbe23edf15a34139c2825f91f5a1dd8d8c76..0339a641ce4ec7b1e28038caac5e6b3271c979c3 100644
|
| --- a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
|
| +++ b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
|
| @@ -43,6 +43,8 @@ namespace {
|
|
|
| blink::InstallConditionalFeaturesFunction
|
| s_originalInstallConditionalFeaturesFunction = nullptr;
|
| +blink::InstallPendingConditionalFeatureFunction
|
| + s_originalInstallPendingConditionalFeatureFunction = nullptr;
|
|
|
| v8::Local<v8::Value> createInternalsObject(v8::Local<v8::Context> context) {
|
| blink::ScriptState* scriptState = blink::ScriptState::from(context);
|
| @@ -62,13 +64,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();
|
|
|
| blink::ScriptState* scriptState = blink::ScriptState::from(context);
|
| blink::ScriptState::Scope scope(scriptState);
|
| @@ -84,7 +80,7 @@ void injectInternalsObject(v8::Local<v8::Context> context) {
|
| .ToChecked();
|
| }
|
|
|
| -void installConditionalFeaturesForTests(
|
| +void installConditionalFeaturesForTesting(
|
| const blink::WrapperTypeInfo* type,
|
| const blink::ScriptState* scriptState,
|
| v8::Local<v8::Object> prototypeObject,
|
| @@ -127,4 +123,36 @@ void resetInternalsObject(v8::Local<v8::Context> context) {
|
| blink::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
|
|
|