summaryrefslogtreecommitdiff
path: root/chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-09-29 16:16:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-11-09 10:04:06 +0000
commita95a7417ad456115a1ef2da4bb8320531c0821f1 (patch)
treeedcd59279e486d2fd4a8f88a7ed025bcf925c6e6 /chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc
parent33fc33aa94d4add0878ec30dc818e34e1dd3cc2a (diff)
downloadqtwebengine-chromium-a95a7417ad456115a1ef2da4bb8320531c0821f1.tar.gz
BASELINE: Update Chromium to 106.0.5249.126
Change-Id: Ib0bb21c437a7d1686e21c33f2d329f2ac425b7ab Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/438936 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc')
-rw-r--r--chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc63
1 files changed, 37 insertions, 26 deletions
diff --git a/chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc b/chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc
index 80f3c829a70..489881b8d3a 100644
--- a/chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc
+++ b/chromium/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc
@@ -53,6 +53,7 @@
#include "third_party/blink/public/mojom/file_system_access/file_system_access_data_transfer_token.mojom.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-forward.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-shared.h"
+#include "ui/shell_dialogs/select_file_dialog.h"
#include "url/gurl.h"
namespace content {
@@ -415,7 +416,8 @@ TEST_F(FileSystemAccessManagerImplTest, GetSandboxedFileSystem_CustomBucket) {
mojo::PendingRemote<blink::mojom::FileSystemAccessDirectoryHandle>
directory_remote;
FileSystemAccessManagerImpl::BindingContext binding_context = {
- kTestStorageKey, kTestURL, web_contents_->GetMainFrame()->GetGlobalId()};
+ kTestStorageKey, kTestURL,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId()};
base::test::TestFuture<storage::QuotaErrorOr<storage::BucketInfo>>
bucket_future;
quota_manager_proxy_->CreateBucketForTesting(
@@ -446,7 +448,8 @@ TEST_F(FileSystemAccessManagerImplTest, GetSandboxedFileSystem_BadBucket) {
mojo::PendingRemote<blink::mojom::FileSystemAccessDirectoryHandle>
directory_remote;
FileSystemAccessManagerImpl::BindingContext binding_context = {
- kTestStorageKey, kTestURL, web_contents_->GetMainFrame()->GetGlobalId()};
+ kTestStorageKey, kTestURL,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId()};
const auto bucket = storage::BucketLocator(
storage::BucketId(12), kTestStorageKey,
blink::mojom::StorageType::kUnknown, /*is_default=*/false);
@@ -1276,12 +1279,13 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_OpenFile) {
entry.path = test_file;
manager_->SetFilePickerResultForTesting(std::move(entry));
- static_cast<TestRenderFrameHost*>(web_contents_->GetMainFrame())
+ static_cast<TestRenderFrameHost*>(web_contents_->GetPrimaryMainFrame())
->SimulateUserActivation();
mojo::Remote<blink::mojom::FileSystemAccessManager> manager_remote;
FileSystemAccessManagerImpl::BindingContext binding_context = {
- kTestStorageKey, kTestURL, web_contents_->GetMainFrame()->GetGlobalId()};
+ kTestStorageKey, kTestURL,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId()};
manager_->BindReceiver(binding_context,
manager_remote.BindNewPipeAndPassReceiver());
@@ -1304,13 +1308,14 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_OpenFile) {
EXPECT_CALL(
permission_context_,
- ConfirmSensitiveDirectoryAccess_(
+ ConfirmSensitiveEntryAccess_(
kTestStorageKey.origin(),
FileSystemAccessPermissionContext::PathType::kLocal, test_file,
FileSystemAccessPermissionContext::HandleType::kFile,
- web_contents_->GetMainFrame()->GetGlobalId(), testing::_))
- .WillOnce(RunOnceCallback<5>(FileSystemAccessPermissionContext::
- SensitiveDirectoryResult::kAllowed));
+ ui::SelectFileDialog::Type::SELECT_OPEN_FILE,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId(), testing::_))
+ .WillOnce(RunOnceCallback<6>(
+ FileSystemAccessPermissionContext::SensitiveEntryResult::kAllowed));
EXPECT_CALL(permission_context_,
GetReadPermissionGrant(
@@ -1357,12 +1362,13 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_SaveFile) {
entry.path = test_file;
manager_->SetFilePickerResultForTesting(std::move(entry));
- static_cast<TestRenderFrameHost*>(web_contents_->GetMainFrame())
+ static_cast<TestRenderFrameHost*>(web_contents_->GetPrimaryMainFrame())
->SimulateUserActivation();
mojo::Remote<blink::mojom::FileSystemAccessManager> manager_remote;
FileSystemAccessManagerImpl::BindingContext binding_context = {
- kTestStorageKey, kTestURL, web_contents_->GetMainFrame()->GetGlobalId()};
+ kTestStorageKey, kTestURL,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId()};
manager_->BindReceiver(binding_context,
manager_remote.BindNewPipeAndPassReceiver());
@@ -1388,13 +1394,14 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_SaveFile) {
EXPECT_CALL(
permission_context_,
- ConfirmSensitiveDirectoryAccess_(
+ ConfirmSensitiveEntryAccess_(
kTestStorageKey.origin(),
FileSystemAccessPermissionContext::PathType::kLocal, test_file,
FileSystemAccessPermissionContext::HandleType::kFile,
- web_contents_->GetMainFrame()->GetGlobalId(), testing::_))
- .WillOnce(RunOnceCallback<5>(FileSystemAccessPermissionContext::
- SensitiveDirectoryResult::kAllowed));
+ ui::SelectFileDialog::Type::SELECT_SAVEAS_FILE,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId(), testing::_))
+ .WillOnce(RunOnceCallback<6>(
+ FileSystemAccessPermissionContext::SensitiveEntryResult::kAllowed));
EXPECT_CALL(permission_context_,
GetReadPermissionGrant(
@@ -1440,12 +1447,13 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_OpenDirectory) {
entry.path = test_dir;
manager_->SetFilePickerResultForTesting(std::move(entry));
- static_cast<TestRenderFrameHost*>(web_contents_->GetMainFrame())
+ static_cast<TestRenderFrameHost*>(web_contents_->GetPrimaryMainFrame())
->SimulateUserActivation();
mojo::Remote<blink::mojom::FileSystemAccessManager> manager_remote;
FileSystemAccessManagerImpl::BindingContext binding_context = {
- kTestStorageKey, kTestURL, web_contents_->GetMainFrame()->GetGlobalId()};
+ kTestStorageKey, kTestURL,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId()};
manager_->BindReceiver(binding_context,
manager_remote.BindNewPipeAndPassReceiver());
@@ -1466,14 +1474,16 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_OpenDirectory) {
SetLastPickedDirectory(kTestStorageKey.origin(), std::string(),
test_dir, PathType::kLocal));
- EXPECT_CALL(permission_context_,
- ConfirmSensitiveDirectoryAccess_(
- kTestStorageKey.origin(),
- FileSystemAccessPermissionContext::PathType::kLocal, test_dir,
- FileSystemAccessPermissionContext::HandleType::kDirectory,
- web_contents_->GetMainFrame()->GetGlobalId(), testing::_))
- .WillOnce(RunOnceCallback<5>(FileSystemAccessPermissionContext::
- SensitiveDirectoryResult::kAllowed));
+ EXPECT_CALL(
+ permission_context_,
+ ConfirmSensitiveEntryAccess_(
+ kTestStorageKey.origin(),
+ FileSystemAccessPermissionContext::PathType::kLocal, test_dir,
+ FileSystemAccessPermissionContext::HandleType::kDirectory,
+ ui::SelectFileDialog::Type::SELECT_FOLDER,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId(), testing::_))
+ .WillOnce(RunOnceCallback<6>(
+ FileSystemAccessPermissionContext::SensitiveEntryResult::kAllowed));
EXPECT_CALL(permission_context_,
GetReadPermissionGrant(
@@ -1515,12 +1525,13 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_InvalidStartInID) {
entry.path = test_dir;
manager_->SetFilePickerResultForTesting(std::move(entry));
- static_cast<TestRenderFrameHost*>(web_contents_->GetMainFrame())
+ static_cast<TestRenderFrameHost*>(web_contents_->GetPrimaryMainFrame())
->SimulateUserActivation();
mojo::Remote<blink::mojom::FileSystemAccessManager> manager_remote;
FileSystemAccessManagerImpl::BindingContext binding_context = {
- kTestStorageKey, kTestURL, web_contents_->GetMainFrame()->GetGlobalId()};
+ kTestStorageKey, kTestURL,
+ web_contents_->GetPrimaryMainFrame()->GetGlobalId()};
manager_->BindReceiver(binding_context,
manager_remote.BindNewPipeAndPassReceiver());