Commit 6ede42ab authored by James Hollyer's avatar James Hollyer Committed by Commit Bot

Call the proper CommitChange method from Geolocation Bubble Model

Changes to the Radio Button's was not properly committing because the
wrong CommitChange method was being called. The method needed is the
override from the ContentSettingSingleRadioGroup.

Bug: 1139250
Change-Id: I9d8d74f21debe7fbeed5acac80d1b24615d5ad3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490783Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarAdrienne Porter Felt <felt@chromium.org>
Commit-Queue: James Hollyer <jameshollyer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821546}
parent 74d1cce6
......@@ -1356,7 +1356,7 @@ void ContentSettingGeolocationBubbleModel::CommitChanges() {
if (show_system_geolocation_bubble_)
return;
ContentSettingBubbleModel::CommitChanges();
ContentSettingSingleRadioGroup::CommitChanges();
}
void ContentSettingGeolocationBubbleModel::
......
......@@ -1051,6 +1051,41 @@ TEST_F(ContentSettingBubbleModelTest, Geolocation) {
l10n_util::GetStringUTF16(IDS_BLOCKED_GEOLOCATION_NO_ACTION));
EXPECT_EQ(bubble_content.radio_group.default_item, 1);
}
// Ensure the selecting and committing of a radio button successfully commits
// and becomes the default selection next time a bubble is created.
{
auto content_setting_bubble_model =
std::make_unique<ContentSettingGeolocationBubbleModel>(nullptr,
web_contents());
std::unique_ptr<FakeOwner> owner =
FakeOwner::Create(*content_setting_bubble_model, 0);
const auto& bubble_content = content_setting_bubble_model->bubble_content();
ASSERT_EQ(bubble_content.radio_group.radio_items.size(), 2U);
EXPECT_EQ(bubble_content.radio_group.default_item, 1);
owner->SetSelectedRadioOptionAndCommit(0);
}
{
auto content_setting_bubble_model =
std::make_unique<ContentSettingGeolocationBubbleModel>(nullptr,
web_contents());
std::unique_ptr<FakeOwner> owner =
FakeOwner::Create(*content_setting_bubble_model, 0);
const auto& bubble_content = content_setting_bubble_model->bubble_content();
ASSERT_EQ(bubble_content.radio_group.radio_items.size(), 2U);
EXPECT_EQ(bubble_content.radio_group.default_item, 0);
owner->SetSelectedRadioOptionAndCommit(1);
}
{
auto content_setting_bubble_model =
std::make_unique<ContentSettingGeolocationBubbleModel>(nullptr,
web_contents());
std::unique_ptr<FakeOwner> owner =
FakeOwner::Create(*content_setting_bubble_model, 0);
const auto& bubble_content = content_setting_bubble_model->bubble_content();
ASSERT_EQ(bubble_content.radio_group.radio_items.size(), 2U);
EXPECT_EQ(bubble_content.radio_group.default_item, 1);
}
}
TEST_F(ContentSettingBubbleModelTest, FileURL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment