-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[FedCM] Implement a command line option to use a fake UI"
This reverts commit 4880920. Reason for revert: Findit (https://goo.gl/kROfz5) identified this CL at revision 4880920 as the culprit for failures in the continuous build including: Sample Failed Build: https://ci.chromium.org/b/8818226933029618241 Sample Failed Step: compile If it is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?status=Available&comment=Datastore+key+for+the+culprit+entity%3A+chromium.googlesource.com%2Fchromium%2Fsrc%2Frefs%2Fheads%2Fmain%2F48809204fea3a0b4498a9a995c30dadca6f8d0a3&labels=Test-Findit-Wrong&components=Tools%3ETest%3EFindIt&summary=Wrongly+blame+48809204fea3a0b4498a9a995c30dadca6f8d0a3 Original change's description: > [FedCM] Implement a command line option to use a fake UI > > This is useful for WPT tests and Webdriver, along the lines of the > existing --use-fake-ui-for-media-stream. > > This also merges the two existing fake dialogs into a single impl > in content/public/browser. > > Bug: 1302097 > Change-Id: I7bc173c432a17755c2c3ea7ecc9c4c64fd3166d5 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3546261 > Reviewed-by: Yi Gu <yigu@chromium.org> > Reviewed-by: John Abd-El-Malek <jam@chromium.org> > Commit-Queue: Christian Biesinger <cbiesinger@chromium.org> > Cr-Commit-Position: refs/heads/main@{#987225} Change-Id: Ida0e5f6ce4c6e10ef102dea971f2b7383e0595b8 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 1302097 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3562265 Reviewed-by: Jiewei Qian <qjw@chromium.org> Commit-Queue: Jiewei Qian <qjw@chromium.org> Owners-Override: Jiewei Qian <qjw@chromium.org> Cr-Commit-Position: refs/heads/main@{#987345}
- Loading branch information
Findit
authored and
Chromium LUCI CQ
committed
Mar 31, 2022
1 parent
ca4dd20
commit 45b5705
Showing
15 changed files
with
124 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
content/browser/webid/fake_identity_request_dialog_controller.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
...ake_identity_request_dialog_controller.cc → ...ake_identity_request_dialog_controller.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/browser/webid/fake_identity_request_dialog_controller.h" | ||
#include "content/browser/webid/test/fake_identity_request_dialog_controller.h" | ||
|
||
#include "base/bind.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace content { | ||
|
||
FakeIdentityRequestDialogController::FakeIdentityRequestDialogController( | ||
absl::optional<std::string> selected_account) | ||
: selected_account_(selected_account) {} | ||
absl::optional<std::string> dialog_selected_account) | ||
: dialog_selected_account_(dialog_selected_account) {} | ||
|
||
FakeIdentityRequestDialogController::~FakeIdentityRequestDialogController() = | ||
default; | ||
|
||
void FakeIdentityRequestDialogController::ShowAccountsDialog( | ||
content::WebContents* rp_web_contents, | ||
WebContents* rp_web_contents, | ||
const GURL& idp_signin_url, | ||
base::span<const IdentityRequestAccount> accounts, | ||
const IdentityProviderMetadata& idp_metadata, | ||
const ClientIdData& client_id_data, | ||
IdentityRequestAccount::SignInMode sign_in_mode, | ||
AccountSelectionCallback on_selected) { | ||
DCHECK_GT(accounts.size(), 0ul); | ||
// Use the provided account, if any. Otherwise use the first one. | ||
if (selected_account_) | ||
std::move(on_selected).Run(*selected_account_, /* is_sign_in= */ true); | ||
else | ||
std::move(on_selected).Run(accounts[0].id, /* is_sign_in= */ true); | ||
if (dialog_selected_account_) { | ||
std::move(on_selected) | ||
.Run(*dialog_selected_account_, true /* is_sign_in */); | ||
} | ||
} | ||
|
||
} // namespace content |
49 changes: 49 additions & 0 deletions
49
content/browser/webid/test/fake_identity_request_dialog_controller.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CONTENT_BROWSER_WEBID_TEST_FAKE_IDENTITY_REQUEST_DIALOG_CONTROLLER_H_ | ||
#define CONTENT_BROWSER_WEBID_TEST_FAKE_IDENTITY_REQUEST_DIALOG_CONTROLLER_H_ | ||
|
||
#include <string> | ||
|
||
#include "content/public/browser/identity_request_dialog_controller.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
#include "url/gurl.h" | ||
|
||
namespace content { | ||
|
||
class WebContents; | ||
|
||
// This fakes the request dialogs to always provide user consent. | ||
// Tests that need to vary the responses or set test expectations should use | ||
// MockIdentityRequestDialogController. | ||
// This also fakes an IdP sign-in page until tests can be set up to | ||
// verify the FederatedAuthResponse mechanics. | ||
class FakeIdentityRequestDialogController | ||
: public IdentityRequestDialogController { | ||
public: | ||
explicit FakeIdentityRequestDialogController( | ||
absl::optional<std::string> dialog_selected_account); | ||
~FakeIdentityRequestDialogController() override; | ||
|
||
FakeIdentityRequestDialogController( | ||
const FakeIdentityRequestDialogController&) = delete; | ||
FakeIdentityRequestDialogController& operator=( | ||
const FakeIdentityRequestDialogController&) = delete; | ||
|
||
void ShowAccountsDialog(WebContents* rp_web_contents, | ||
const GURL& idp_signin_url, | ||
base::span<const IdentityRequestAccount> accounts, | ||
const IdentityProviderMetadata& idp_metadata, | ||
const ClientIdData& client_id_data, | ||
IdentityRequestAccount::SignInMode sign_in_mode, | ||
AccountSelectionCallback on_selected) override; | ||
|
||
private: | ||
absl::optional<std::string> dialog_selected_account_; | ||
}; | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_BROWSER_WEBID_TEST_FAKE_IDENTITY_REQUEST_DIALOG_CONTROLLER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/shell/browser/shell_identity_dialog_controller.h" | ||
|
||
namespace content { | ||
|
||
void ShellIdentityDialogController::ShowAccountsDialog( | ||
content::WebContents* rp_web_contents, | ||
const GURL& idp_signin_url, | ||
base::span<const IdentityRequestAccount> accounts, | ||
const IdentityProviderMetadata& idp_metadata, | ||
const ClientIdData& client_id_data, | ||
IdentityRequestAccount::SignInMode sign_in_mode, | ||
AccountSelectionCallback on_selected) { | ||
// Similar in spirit to allowlisted permissions in ShellPermissionManager, | ||
// we automatically select the first account here so that tests can pass. | ||
DCHECK_GT(accounts.size(), 0ul); | ||
std::move(on_selected).Run(accounts[0].id, /* is_sign_in= */ false); | ||
} | ||
|
||
} // namespace content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CONTENT_SHELL_BROWSER_SHELL_IDENTITY_DIALOG_CONTROLLER_H_ | ||
#define CONTENT_SHELL_BROWSER_SHELL_IDENTITY_DIALOG_CONTROLLER_H_ | ||
|
||
#include "content/public/browser/identity_request_dialog_controller.h" | ||
|
||
namespace content { | ||
|
||
class ShellIdentityDialogController : public IdentityRequestDialogController { | ||
public: | ||
void ShowAccountsDialog(content::WebContents* rp_web_contents, | ||
const GURL& idp_signin_url, | ||
base::span<const IdentityRequestAccount> accounts, | ||
const IdentityProviderMetadata& idp_metadata, | ||
const ClientIdData& client_id_data, | ||
IdentityRequestAccount::SignInMode sign_in_mode, | ||
AccountSelectionCallback on_selected) override; | ||
}; | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_SHELL_BROWSER_SHELL_IDENTITY_DIALOG_CONTROLLER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters