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..9864241a03642cd8de957a42a9577736b2614099 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,35 @@ void resetInternalsObject(v8::Local<v8::Context> context) { |
InternalSettings::from(*page)->resetToConsistentState(); |
} |
+void installPendingConditionalFeatureForTests(const String& feature, |
haraken
2017/01/28 02:25:20
Nit: ForTests => ForTesting (due to naming convent
chasej
2017/01/30 19:15:56
Done.
|
+ const ScriptState* scriptState) { |
+ (*s_originalInstallPendingConditionalFeatureFunction)(feature, scriptState); |
+ v8::Local<v8::Object> prototypeObject; |
+ v8::Local<v8::Function> interfaceObject; |
+ if (feature == "Frobulate") { |
+ if (scriptState->perContextData() |
+ ->getExistingConstructorAndPrototypeForType( |
+ &V8OriginTrialsTest::wrapperTypeInfo, &prototypeObject, |
+ &interfaceObject)) { |
+ V8OriginTrialsTest::installOriginTrialsSampleAPI( |
+ scriptState->isolate(), scriptState->world(), v8::Local<v8::Object>(), |
+ prototypeObject, interfaceObject); |
+ } |
+ return; |
+ } |
+} |
+ |
+void registerInstallConditionalFeaturesForTests() { |
haraken
2017/01/28 02:25:20
Ditto.
chasej
2017/01/30 19:15:56
Done.
|
+ if (!s_originalInstallConditionalFeaturesFunction) { |
+ s_originalInstallConditionalFeaturesFunction = |
+ setInstallConditionalFeaturesFunction( |
+ installConditionalFeaturesForTests); |
+ } |
+ if (!s_originalInstallPendingConditionalFeatureFunction) { |
+ s_originalInstallPendingConditionalFeatureFunction = |
+ setInstallPendingConditionalFeatureFunction( |
+ &installPendingConditionalFeatureForTests); |
+ } |
+} |
+ |
} // namespace WebCoreTestSupport |