Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into master.lion
Browse files Browse the repository at this point in the history
  • Loading branch information
blueboxd committed Jun 8, 2023
2 parents 964d4f7 + fbf19db commit d45e831
Show file tree
Hide file tree
Showing 50 changed files with 415 additions and 1,534 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ deps = {

'src/clank': {
'url': Var('chrome_git') + '/clank/internal/apps.git' + '@' +
'b99040d05426c7253a27aee1b400c349770d6f06',
'6376d5c61c31ae64d89d0c0d1dd446360730c2e2',
'condition': 'checkout_android and checkout_src_internal',
},

Expand Down Expand Up @@ -1007,7 +1007,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/androidx',
'version': '8EW3iHyrSSsOJnUnVY3yKilFduKdTrYqL9ScMbo_kJsC',
'version': '0xrH7TlgFCWjxChuPujrxiq0sxzr4r6mV7wdkEkhTs0C',
},
],
'condition': 'checkout_android',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,6 @@ namespace extensions {

namespace {

// TODO(crbug.com/1449321): Remove this TestAutofillClient and use the main
// TestAutofillClient instead.
class TestChromeAutofillClient : public autofill::ChromeAutofillClient {
public:
explicit TestChromeAutofillClient(content::WebContents* web_contents)
: ChromeAutofillClient(web_contents) {}

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
scoped_refptr<device_reauth::DeviceAuthenticator> GetDeviceAuthenticator()
const override {
return mock_device_authenticator_;
}

autofill::PersonalDataManager* GetPersonalDataManager() override {
return personal_data_manager_;
}

autofill::FormDataImporter* GetFormDataImporter() override {
if (!form_data_importer_) {
form_data_importer_ = std::make_unique<autofill::FormDataImporter>(
/*client=*/this, /*payments_client=*/nullptr,
/*personal_data_manager=*/nullptr, /*app_locale=*/"en-US");
}

return form_data_importer_.get();
}

void SetDeviceAuthenticator(
scoped_refptr<device_reauth::MockDeviceAuthenticator> mock_auth) {
mock_device_authenticator_ = mock_auth;
}

void SetPersonalDataManger(autofill::TestPersonalDataManager* mock_pdm) {
personal_data_manager_ = mock_pdm;
}

scoped_refptr<device_reauth::MockDeviceAuthenticator>
mock_device_authenticator_;
raw_ptr<autofill::TestPersonalDataManager> personal_data_manager_ = nullptr;
std::unique_ptr<autofill::FormDataImporter> form_data_importer_;
#endif
};

class AutofillPrivateApiTest : public ExtensionApiTest {
public:
AutofillPrivateApiTest() = default;
Expand All @@ -88,8 +45,6 @@ class AutofillPrivateApiTest : public ExtensionApiTest {
void SetUpOnMainThread() override {
ExtensionApiTest::SetUpOnMainThread();
content::RunAllPendingInMessageLoop();
test_personal_data_manager_ =
std::make_unique<autofill::TestPersonalDataManager>();
}

protected:
Expand All @@ -102,7 +57,7 @@ class AutofillPrivateApiTest : public ExtensionApiTest {
{.load_as_component = true});
}

TestChromeAutofillClient* autofill_client() {
autofill::TestContentAutofillClient* autofill_client() {
return test_autofill_client_injector_
[browser()->tab_strip_model()->GetActiveWebContents()];
}
Expand All @@ -111,7 +66,7 @@ class AutofillPrivateApiTest : public ExtensionApiTest {
test_personal_data_manager_;

private:
autofill::TestAutofillClientInjector<TestChromeAutofillClient>
autofill::TestAutofillClientInjector<autofill::TestContentAutofillClient>
test_autofill_client_injector_;
};

Expand Down Expand Up @@ -198,19 +153,18 @@ IN_PROC_BROWSER_TEST_F(AutofillPrivateApiTest, isValidIban) {
IN_PROC_BROWSER_TEST_F(AutofillPrivateApiTest,
authenticateUserAndFlipMandatoryAuthToggle) {
base::UserActionTester user_action_tester;
scoped_refptr<device_reauth::MockDeviceAuthenticator>
mock_device_authenticator =
base::MakeRefCounted<device_reauth::MockDeviceAuthenticator>();
TestChromeAutofillClient* test_client = autofill_client();
test_client->SetDeviceAuthenticator(mock_device_authenticator);
auto mock_device_authenticator = autofill_client()->GetDeviceAuthenticator();

ON_CALL(*mock_device_authenticator, AuthenticateWithMessage)
ON_CALL(*static_cast<device_reauth::MockDeviceAuthenticator*>(
mock_device_authenticator.get()),
AuthenticateWithMessage)
.WillByDefault(
testing::WithArg<1>([](base::OnceCallback<void(bool)> callback) {
std::move(callback).Run(true);
}));

EXPECT_CALL(*mock_device_authenticator,
EXPECT_CALL(*static_cast<device_reauth::MockDeviceAuthenticator*>(
mock_device_authenticator.get()),
AuthenticateWithMessage(testing::_, testing::_))
.Times(1);
EXPECT_TRUE(RunAutofillSubtest("authenticateUserAndFlipMandatoryAuthToggle"))
Expand All @@ -224,22 +178,22 @@ IN_PROC_BROWSER_TEST_F(AutofillPrivateApiTest,
IN_PROC_BROWSER_TEST_F(AutofillPrivateApiTest,
authenticateUserToEditLocalCard) {
base::UserActionTester user_action_tester;
scoped_refptr<device_reauth::MockDeviceAuthenticator>
mock_device_authenticator =
base::MakeRefCounted<device_reauth::MockDeviceAuthenticator>();
TestChromeAutofillClient* test_client = autofill_client();

test_personal_data_manager_->SetPaymentMethodsMandatoryReauthEnabled(true);
test_client->SetPersonalDataManger(test_personal_data_manager_.get());
test_client->SetDeviceAuthenticator(mock_device_authenticator);
autofill_client()
->GetPersonalDataManager()
->SetPaymentMethodsMandatoryReauthEnabled(true);
auto mock_device_authenticator = autofill_client()->GetDeviceAuthenticator();

ON_CALL(*mock_device_authenticator, AuthenticateWithMessage)
ON_CALL(*static_cast<device_reauth::MockDeviceAuthenticator*>(
mock_device_authenticator.get()),
AuthenticateWithMessage)
.WillByDefault(
testing::WithArg<1>([](base::OnceCallback<void(bool)> callback) {
std::move(callback).Run(true);
}));

EXPECT_CALL(*mock_device_authenticator,
EXPECT_CALL(*static_cast<device_reauth::MockDeviceAuthenticator*>(
mock_device_authenticator.get()),
AuthenticateWithMessage(testing::_, testing::_))
.Times(1);
EXPECT_TRUE(RunAutofillSubtest("authenticateUserToEditLocalCard"))
Expand Down
1 change: 1 addition & 0 deletions chrome/test/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ instrumentation_test_runner("chrome_public_apk_baseline_profile_generator") {
extra_args = [
"--use-apk-under-test-flags-file",
"--disable-fre",
"--strict-mode=off",
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,25 @@ public void setUp() {
@LargeTest
public void testGenerateBaselineProfile() {
Context context = ApplicationProvider.getApplicationContext();
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(DATA_URL));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
final Intent cct_intent = new Intent(Intent.ACTION_VIEW, Uri.parse(DATA_URL));
cct_intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// Mark it as a CCT session.
intent.putExtra(CCT_SESSION_EXTRA, (Bundle) null);
intent.setComponent(new ComponentName(mPackageName, ACTIVITY_NAME));
mBaselineProfileRule.collectBaselineProfile(
cct_intent.putExtra(CCT_SESSION_EXTRA, (Bundle) null);
cct_intent.setComponent(new ComponentName(mPackageName, ACTIVITY_NAME));
mBaselineProfileRule.collect(
/* packageName= */ mPackageName,
/* iterations= */ 5,
/* maxIterations= */ 15,
/* stableIterations= */ 3,
/* outputFilePrefix= */ null,
/* includeInStartupProfile= */ true,
/* profileBlock= */
scope -> {
scope.startActivityAndWait(intent);
scope.startActivityAndWait(cct_intent);
final Intent cta_intent = new Intent(Intent.ACTION_VIEW, Uri.parse(DATA_URL));
cta_intent.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
cta_intent.setComponent(new ComponentName(mPackageName, ACTIVITY_NAME));
scope.startActivityAndWait(cta_intent);
return Unit.INSTANCE;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ source_set("browser_agent_util") {
"//components/safe_browsing/core/common",
"//ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile",
"//ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/confirm",
"//ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/translate",
"//ios/chrome/browser/overlays/public/infobar_banner",
"//ios/chrome/browser/shared/model/browser",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_banner_interaction_handler.h"
#import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.h"
#import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/confirm/confirm_infobar_banner_interaction_handler.h"
#import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/translate/translate_infobar_banner_interaction_handler.h"
#import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/translate/translate_infobar_modal_interaction_handler.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
Expand Down Expand Up @@ -42,16 +40,14 @@ void AttachInfobarOverlayBrowserAgent(Browser* browser) {
browser_agent->AddDefaultInfobarInteractionHandlerForInfobarType(
InfobarType::kInfobarTypeSyncError);

browser_agent->AddDefaultInfobarInteractionHandlerForInfobarType(
InfobarType::kInfobarTypeTranslate);

browser_agent->AddInfobarInteractionHandler(
std::make_unique<InfobarInteractionHandler>(
InfobarType::kInfobarTypeConfirm,
std::make_unique<ConfirmInfobarBannerInteractionHandler>(),
/*modal_handler=*/nullptr));
browser_agent->AddInfobarInteractionHandler(
std::make_unique<InfobarInteractionHandler>(
InfobarType::kInfobarTypeTranslate,
std::make_unique<TranslateInfobarBannerInteractionHandler>(),
std::make_unique<TranslateInfobarModalInteractionHandler>()));
browser_agent->AddInfobarInteractionHandler(std::make_unique<
InfobarInteractionHandler>(
InfobarType::kInfobarTypeSaveAutofillAddressProfile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ source_set("test") {
"mock_infobar_interaction_handler.mm",
"mock_save_address_profile_modal_infobar_interaction_handler.h",
"mock_save_address_profile_modal_infobar_interaction_handler.mm",
"mock_translate_infobar_interaction_handler.h",
"mock_translate_infobar_interaction_handler.mm",
]

configs += [ "//build/config/compiler:enable_arc" ]
Expand All @@ -29,7 +27,6 @@ source_set("test") {
"//ios/chrome/browser/infobars/overlays",
"//ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers",
"//ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile",
"//ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/translate",
"//ios/chrome/browser/overlays",
"//ios/chrome/browser/overlays/public/common/infobars",
"//ios/chrome/browser/overlays/public/infobar_banner",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d45e831

Please sign in to comment.