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

Unified Diff: chrome/browser/web_bluetooth_browsertest.cc

Issue 2314953002: bluetooth: web: Blacklist field trial test handles missing config. (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_bluetooth_browsertest.cc
diff --git a/chrome/browser/web_bluetooth_browsertest.cc b/chrome/browser/web_bluetooth_browsertest.cc
index a6fe14be253f949e7a57a3851f19e1d36260e81b..a8beb50e2355c8c16cbd6412537648efe4e4560d 100644
--- a/chrome/browser/web_bluetooth_browsertest.cc
+++ b/chrome/browser/web_bluetooth_browsertest.cc
@@ -132,10 +132,26 @@ IN_PROC_BROWSER_TEST_F(WebBluetoothTest, BlacklistShouldBlock) {
EXPECT_CALL(*adapter, IsPresent()).WillRepeatedly(Return(true));
device::BluetoothAdapterFactory::SetAdapterForTesting(adapter);
- ASSERT_TRUE(base::FieldTrialList::TrialExists("WebBluetoothBlacklist"))
- << "ERROR: testing/variations/fieldtrial_testing_config_*.json must\n"
- << "include WebBluetoothBlacklist trial with the blacklist_additions\n"
- << "parameter including this test's random UUID 'ed5f25a4'.\n";
+ if (base::FieldTrialList::TrialExists("WebBluetoothBlacklist")) {
+ LOG(INFO) << "WebBluetoothBlacklist field trial already configured.";
+ ASSERT_NE(variations::GetVariationParamValue("WebBluetoothBlacklist",
+ "blacklist_additions")
+ .find("ed5f25a4"),
+ std::string::npos)
+ << "ERROR: WebBluetoothBlacklist field trial being tested in\n"
+ "testing/variations/fieldtrial_testing_config_*.json must\n"
+ "include this test's random UUID 'ed5f25a4' in\n"
+ "blacklist_additions.\n";
+ } else {
+ LOG(INFO) << "Creating WebBluetoothBlacklist field trial for test.";
+ // Create a field trial with test parameter.
+ std::map<std::string, std::string> params;
+ params["blacklist_additions"] = "ed5f25a4:e";
+ variations::AssociateVariationParams("WebBluetoothBlacklist", "TestGroup",
+ params);
+ base::FieldTrialList::CreateFieldTrial("WebBluetoothBlacklist",
+ "TestGroup");
+ }
std::string rejection;
EXPECT_TRUE(content::ExecuteScriptAndExtractString(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698