Skip to content

Commit

Permalink
[FedCM] Remove vendor prefix for click dialog button command
Browse files Browse the repository at this point in the history
Approved spec PR
w3c-fedid/FedCM#510

Bug: 1499341
Change-Id: Ie5287e999f5ae45bb91a296754f18a68f64522e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5092527
Reviewed-by: Vladimir Nechaev <[email protected]>
Reviewed-by: Christian Biesinger <[email protected]>
Commit-Queue: Zachary Tan <[email protected]>
Reviewed-by: Mathias Bynens <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1233995}
  • Loading branch information
tttzach authored and Chromium LUCI CQ committed Dec 6, 2023
1 parent 9930aea commit 1de1f0e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions client/chromedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ def SelectAccount(self, index):
params = {'accountIndex': index}
return self.ExecuteCommand(Command.SELECT_ACCOUNT, params)

def ClickFedCmDialogButton(self, vendorId, dialogButton):
params = {'vendorId': vendorId, 'dialogButton': dialogButton}
def ClickFedCmDialogButton(self, dialogButton):
params = {'dialogButton': dialogButton}
return self.ExecuteCommand(Command.CLICK_FEDCM_DIALOG_BUTTON, params)

def GetAccounts(self):
Expand Down
2 changes: 1 addition & 1 deletion client/command_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class Command(object):
'/session/:sessionId/fedcm/selectaccount')
CLICK_FEDCM_DIALOG_BUTTON = (
_Method.POST,
'/session/:sessionId/:vendorId/fedcm/clickdialogbutton')
'/session/:sessionId/fedcm/clickdialogbutton')
GET_ACCOUNTS = (
_Method.GET,
'/session/:sessionId/fedcm/accountlist')
Expand Down
6 changes: 2 additions & 4 deletions server/http_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,8 @@ HttpHandler::HttpHandler(
WrapToCommand("SelectAccount",
base::BindRepeating(&ExecuteSelectAccount))),

// This command is prefixed because standardization is still pending:
// https://github.com/fedidcg/FedCM/pull/436/files
VendorPrefixedCommandMapping(
kPost, "session/:sessionId/%s/fedcm/clickdialogbutton",
CommandMapping(
kPost, "session/:sessionId/fedcm/clickdialogbutton",
WrapToCommand("ClickDialogButton",
base::BindRepeating(&ExecuteClickDialogButton))),

Expand Down
10 changes: 3 additions & 7 deletions test/run_py_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7500,9 +7500,6 @@ def testGetSinks(self):
class FedCmSpecificTest(ChromeDriverBaseTestWithWebServer):

def setUp(self):
global _VENDOR_ID
self._vendor_id = _VENDOR_ID

port = self._https_server._server.server_port
self._url_prefix = (self._https_server.GetUrl("localhost") +
"/chromedriver/fedcm")
Expand Down Expand Up @@ -7694,8 +7691,7 @@ def testConfirmIdpLogin(self):

self._accounts = self._default_accounts

self._driver.ClickFedCmDialogButton(self._vendor_id,
"ConfirmIdpLoginContinue")
self._driver.ClickFedCmDialogButton("ConfirmIdpLoginContinue")

self.assertTrue(self.WaitForCondition(self.FedCmDialogCondition))
accounts = self._driver.GetAccounts()
Expand Down Expand Up @@ -7734,7 +7730,7 @@ def testClickErrorGotIt(self):

self.assertTrue(self.WaitForCondition(self.FedCmDialogCondition))
self.assertEqual("Error", self._driver.GetDialogType())
self._driver.ClickFedCmDialogButton(self._vendor_id, "ErrorGotIt")
self._driver.ClickFedCmDialogButton("ErrorGotIt")

error = self._driver.ExecuteScript("return getResult()")
self.assertEqual("IdentityCredentialError: Error retrieving a token. "
Expand Down Expand Up @@ -7768,7 +7764,7 @@ def testClickErrorMoreDetails(self):

self.assertTrue(self.WaitForCondition(self.FedCmDialogCondition))
self.assertEqual("Error", self._driver.GetDialogType())
self._driver.ClickFedCmDialogButton(self._vendor_id, "ErrorMoreDetails")
self._driver.ClickFedCmDialogButton("ErrorMoreDetails")

error = self._driver.ExecuteScript("return getResult()")
self.assertTrue(self.WaitForCondition(self.FedCmPopupWindowCondition))
Expand Down

0 comments on commit 1de1f0e

Please sign in to comment.