Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp

Issue 1541983003: Force all experiment enabled checks to use ExperimentalFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698