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

Side by Side Diff: chrome/browser/web_bluetooth_browsertest.cc

Issue 2306473002: bluetooth: web: Update Blacklist field trial with Cypress & FIDO services. (Closed)
Patch Set: fix test 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 unified diff | Download patch
« no previous file with comments | « no previous file | testing/variations/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains browsertests for Web Bluetooth that depend on behavior 5 // This file contains browsertests for Web Bluetooth that depend on behavior
6 // defined in chrome/, not just in content/. 6 // defined in chrome/, not just in content/.
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "chrome/browser/permissions/permission_context_base.h" 10 #include "chrome/browser/permissions/permission_context_base.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Tests that using Finch field trial parameters for blacklist additions has 126 // Tests that using Finch field trial parameters for blacklist additions has
127 // the effect of rejecting requestDevice calls. 127 // the effect of rejecting requestDevice calls.
128 IN_PROC_BROWSER_TEST_F(WebBluetoothTest, BlacklistShouldBlock) { 128 IN_PROC_BROWSER_TEST_F(WebBluetoothTest, BlacklistShouldBlock) {
129 // Fake the BluetoothAdapter to say it's present. 129 // Fake the BluetoothAdapter to say it's present.
130 scoped_refptr<device::MockBluetoothAdapter> adapter = 130 scoped_refptr<device::MockBluetoothAdapter> adapter =
131 new testing::NiceMock<device::MockBluetoothAdapter>; 131 new testing::NiceMock<device::MockBluetoothAdapter>;
132 EXPECT_CALL(*adapter, IsPresent()).WillRepeatedly(Return(true)); 132 EXPECT_CALL(*adapter, IsPresent()).WillRepeatedly(Return(true));
133 device::BluetoothAdapterFactory::SetAdapterForTesting(adapter); 133 device::BluetoothAdapterFactory::SetAdapterForTesting(adapter);
134 134
135 std::map<std::string, std::string> params; 135 ASSERT_TRUE(base::FieldTrialList::TrialExists("WebBluetoothBlacklist"))
136 params["blacklist_additions"] = "ee01:e"; 136 << "ERROR: testing/variations/fieldtrial_testing_config_*.json must\n"
137 variations::AssociateVariationParams("WebBluetoothBlacklist", "TestGroup", 137 << "include WebBluetoothBlacklist trial with the blacklist_additions\n"
138 params); 138 << "parameter including this test's random UUID 'ed5f25a4'.\n";
139 base::FieldTrialList::CreateFieldTrial("WebBluetoothBlacklist", "TestGroup");
140 139
141 std::string rejection; 140 std::string rejection;
142 EXPECT_TRUE(content::ExecuteScriptAndExtractString( 141 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
143 web_contents_, 142 web_contents_,
144 "navigator.bluetooth.requestDevice({filters: [{services: [0xee01]}]})" 143 "navigator.bluetooth.requestDevice({filters: [{services: [0xed5f25a4]}]})"
145 " .then(() => { domAutomationController.send('Success'); }," 144 " .then(() => { domAutomationController.send('Success'); },"
146 " reason => {" 145 " reason => {"
147 " domAutomationController.send(reason.name + ': ' + reason.message);" 146 " domAutomationController.send(reason.name + ': ' + reason.message);"
148 " });", 147 " });",
149 &rejection)); 148 &rejection));
150 EXPECT_THAT(rejection, 149 EXPECT_THAT(rejection,
151 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); 150 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*"));
152 } 151 }
153 152
154 } // namespace 153 } // namespace
OLDNEW
« no previous file with comments | « no previous file | testing/variations/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698