Commit ac255910 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update usage of OTR profiles in durable_storage_permission_context tests

Profile API is being updated (issue 1033903) and the usage of
GetOffTheRecordProfile and HasOffTheRecordProfile without argument is
getting deprecated. Use cases of this call that ONLY refer to incognito
or guest mode can use [Get/Has]PrimaryOTRProfile() instead.

Incognito test in durable_storage_permission_context_unittest.cc is
updated to use the new API, and a new test is added for non-primary OTR
profiles.

Bug: 1060940
Change-Id: Iaa55ded4a36f993bca833ea0f68afcc9908cf693
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2195961
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770031}
parent 169b092f
...@@ -112,7 +112,33 @@ TEST_F(DurableStoragePermissionContextTest, Bookmarked) { ...@@ -112,7 +112,33 @@ TEST_F(DurableStoragePermissionContextTest, Bookmarked) {
TEST_F(DurableStoragePermissionContextTest, BookmarkAndIncognitoMode) { TEST_F(DurableStoragePermissionContextTest, BookmarkAndIncognitoMode) {
TestDurablePermissionContext permission_context( TestDurablePermissionContext permission_context(
profile()->GetOffTheRecordProfile()); profile()->GetPrimaryOTRProfile());
GURL url("https://www.google.com");
MakeOriginImportant(url);
NavigateAndCommit(url);
const permissions::PermissionRequestID id(
web_contents()->GetMainFrame()->GetProcess()->GetID(),
web_contents()->GetMainFrame()->GetRoutingID(), -1);
ASSERT_EQ(0, permission_context.permission_set_count());
ASSERT_FALSE(permission_context.last_permission_set_persisted());
ASSERT_EQ(CONTENT_SETTING_DEFAULT,
permission_context.last_permission_set_setting());
permission_context.DecidePermission(
web_contents(), id, url, url, true /* user_gesture */, base::DoNothing());
// Success.
EXPECT_EQ(1, permission_context.permission_set_count());
EXPECT_TRUE(permission_context.last_permission_set_persisted());
EXPECT_EQ(CONTENT_SETTING_ALLOW,
permission_context.last_permission_set_setting());
}
TEST_F(DurableStoragePermissionContextTest, BookmarkAndNonPrimaryOTRProfile) {
TestDurablePermissionContext permission_context(
profile()->GetOffTheRecordProfile(
Profile::OTRProfileID("Test::DurableStorage")));
GURL url("https://www.google.com"); GURL url("https://www.google.com");
MakeOriginImportant(url); MakeOriginImportant(url);
NavigateAndCommit(url); NavigateAndCommit(url);
......
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