Commit 26550b16 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Install app dialog should not show install button until ready

Bug: 1016202
Change-Id: I820a076ed53960fcb4cc74a5ff1909ccf354453a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1870153
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708126}
parent f3fe3e1f
......@@ -195,6 +195,9 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileManagerDialogBaseTest) {
RunTestURL("foreground/js/ui/file_manager_dialog_base_unittest_gen.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, InstallLinuxPackageDialogTest) {
RunTestURL("foreground/js/ui/install_linux_package_dialog_unittest_gen.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MultiMenu) {
RunTestURL("foreground/js/ui/multi_menu_unittest_gen.html");
}
......
......@@ -380,6 +380,15 @@ js_library("files_menu") {
js_library("install_linux_package_dialog") {
deps = [
":file_manager_dialog_base",
"//ui/file_manager/file_manager/common/js:util",
]
}
js_unittest("install_linux_package_dialog_unittest") {
deps = [
":install_linux_package_dialog",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/webui/resources/js:webui_resource_test",
]
}
......@@ -504,6 +513,7 @@ js_test_gen_html("js_test_gen_html") {
":file_table_list_unittest",
":file_table_unittest",
":file_tap_handler_unittest",
":install_linux_package_dialog_unittest",
":multi_menu_unittest",
]
}
......@@ -50,6 +50,7 @@ cr.define('cr.filebrowser', () => {
// We re-use the same object, so reset any visual state that may be
// changed.
this.installButton_.hidden = false;
this.installButton_.disabled = true;
this.okButton.hidden = true;
this.cancelButton.hidden = false;
......@@ -140,6 +141,9 @@ cr.define('cr.filebrowser', () => {
this.details_frame_.appendChild(text);
this.details_frame_.appendChild(this.document_.createElement('br'));
}
// Allow install now.
this.installButton_.disabled = false;
}
/**
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function testInstallButtonHiddenUntilInfoReady() {
// Polyfill chrome.app.window.current().
/** @suppress {checkTypes,const} */
chrome.app = {window: {current: () => null}};
loadTimeData.data = {};
let getInfoCallback;
/** @suppress {checkTypes,const} */
chrome.fileManagerPrivate = {
getLinuxPackageInfo: (entry, callback) => {
getInfoCallback = callback;
}
};
const container =
assertInstanceof(document.createElement('div'), HTMLElement);
const info = {name: 'n', version: 'v', info: 'i', summary: 's'};
const dialog = new cr.filebrowser.InstallLinuxPackageDialog(container);
// Show dialog and very that install button is disabled.
dialog.showInstallLinuxPackageDialog(/** @type {!Entry} */ ({}));
assertTrue(container.querySelector('.cr-dialog-ok').disabled);
// Button becomes enabled once info is ready.
getInfoCallback(info);
assertFalse(container.querySelector('.cr-dialog-ok').disabled);
}
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