| Index: third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp b/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
|
| index d6138e20ce6558daa95aba12a92f1384547dd012..63759d0296a0d4d9edcb2a70eceb4a8d96778b4c 100644
|
| --- a/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
|
| +++ b/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
|
| @@ -90,6 +90,13 @@ protected:
|
| return Experiments::isApiEnabled(executionContext(), apiName, errorMessage);
|
| }
|
|
|
| + bool isApiEnabledWithoutErrorMessage(const String& origin, const String& apiName, const char* apiKeyValue)
|
| + {
|
| + setPageOrigin(origin);
|
| + addApiKey(apiKeyValue);
|
| + return Experiments::isApiEnabled(executionContext(), apiName);
|
| + }
|
| +
|
| private:
|
| OwnPtr<DummyPageHolder> m_page;
|
| RefPtrWillBePersistent<HTMLDocument> m_document;
|
| @@ -107,6 +114,15 @@ TEST_F(ExperimentsTest, EnabledNonExistingAPI)
|
| EXPECT_EQ(("The provided key(s) are not valid for the 'This API does not exist' API."), errorMessage);
|
| }
|
|
|
| +TEST_F(ExperimentsTest, EnabledNonExistingAPIWithoutErrorMessage)
|
| +{
|
| + bool isNonExistingApiEnabled = isApiEnabledWithoutErrorMessage(
|
| + kFrobulateEnabledOrigin,
|
| + kNonExistingAPIName,
|
| + kFrobulateAPIName /* Use existing api name as the key value */);
|
| + EXPECT_FALSE(isNonExistingApiEnabled);
|
| +}
|
| +
|
| // The API should be enabled if a valid key for the origin is provided
|
| TEST_F(ExperimentsTest, EnabledSecureRegisteredOrigin)
|
| {
|
| @@ -119,6 +135,15 @@ TEST_F(ExperimentsTest, EnabledSecureRegisteredOrigin)
|
| EXPECT_TRUE(errorMessage.isEmpty());
|
| }
|
|
|
| +TEST_F(ExperimentsTest, EnabledSecureRegisteredOriginWithoutErrorMessage)
|
| +{
|
| + bool isOriginEnabled = isApiEnabledWithoutErrorMessage(
|
| + kFrobulateEnabledOrigin,
|
| + kFrobulateAPIName,
|
| + kFrobulateAPIName /* Use just the api name as the key value */);
|
| + EXPECT_TRUE(isOriginEnabled);
|
| +}
|
| +
|
| // The API should not be enabled if the origin is unsecure, even if a valid
|
| // key for the origin is provided
|
| TEST_F(ExperimentsTest, EnabledNonSecureRegisteredOrigin)
|
|
|