Commit dc0a0084 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Add tests for FilesApp file extension dialog fix CL:1280383

Add SelectFileDialogExtensionBrowserTests for the fix for issue 453634
using the new test API added in CL:1282623 which returns the extension
dialog's CanResize() behavior.

  SelectFileDialogExtensionBrowserTest/CanResize
    - the dialog should be resizable.

  SelectFileDialogExtensionBrowserTest/CanResize_TabletMode
    - the dialog should not be resizable.

Bug: 453634
Change-Id: I111462857193d337f5cb81715ed509321ae32293
Reviewed-on: https://chromium-review.googlesource.com/c/1286244Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600602}
parent e2ea2d5b
......@@ -18,6 +18,7 @@
#include "chrome/browser/chromeos/file_manager/volume_manager.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/tablet_mode_client_test_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
......@@ -129,7 +130,7 @@ class SelectFileDialogExtensionBrowserTest
downloads_dir_);
// The test resources are setup: enable and add default ChromeOS component
// extensions now and not before: crbug.com/831074, crbug.com/804413
// extensions now and not before: crbug.com/831074, crbug.com/804413.
file_manager::test::AddDefaultComponentExtensionsOnMainThread(profile());
}
......@@ -197,6 +198,10 @@ class SelectFileDialogExtensionBrowserTest
}
}
bool OpenDialogIsResizable() const {
return dialog_->IsResizeable(); // See crrev.com/600185.
}
void TryOpeningSecondDialog(const gfx::NativeWindow& owning_window) {
second_listener_.reset(new MockSelectFileDialogListener());
second_dialog_ = new SelectFileDialogExtension(second_listener_.get(),
......@@ -262,6 +267,32 @@ IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, DestroyListener) {
listener_.reset();
}
IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, CanResize) {
gfx::NativeWindow owning_window = browser()->window()->GetNativeWindow();
// Open the file dialog on the default path.
ASSERT_NO_FATAL_FAILURE(OpenDialog(ui::SelectFileDialog::SELECT_OPEN_FILE,
base::FilePath(), owning_window, ""));
// The dialog should be resizable.
ASSERT_TRUE(OpenDialogIsResizable());
}
IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest,
CanResize_TabletMode) {
gfx::NativeWindow owning_window = browser()->window()->GetNativeWindow();
// Setup tablet mode.
test::SetAndWaitForTabletMode(true);
// Open the file dialog on the default path.
ASSERT_NO_FATAL_FAILURE(OpenDialog(ui::SelectFileDialog::SELECT_OPEN_FILE,
base::FilePath(), owning_window, ""));
// The dialog should not be resizable in tablet mode.
ASSERT_FALSE(OpenDialogIsResizable());
}
// TODO(jamescook): Add a test for selecting a file for an <input type='file'/>
// page element, as that uses different memory management pathways.
// crbug.com/98791
......
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