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

Remove QuickView tests from UI test framework

QuickView involves <webview> and they're secure, chrome extension-only
elements. QuickView is now covered by integration tests which use real
<webview> elements and run with full chrome security.

The UI test framework does not support <webview> and runs without full
chrome security (--disable-web-security) as discussed in [1].

[1] https://bit.ly/2AUVGvK

Bug: 891150
Change-Id: I0bc55495d781b353d8284adfad7ef5877cda9ffa
Reviewed-on: https://chromium-review.googlesource.com/c/1328625Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610343}
parent df2b0c38
...@@ -73,10 +73,6 @@ IN_PROC_BROWSER_TEST_F(FileManagerUITest, CrostiniTasks) { ...@@ -73,10 +73,6 @@ IN_PROC_BROWSER_TEST_F(FileManagerUITest, CrostiniTasks) {
RunTest("crostiniTasks"); RunTest("crostiniTasks");
} }
IN_PROC_BROWSER_TEST_F(FileManagerUITest, QuickView) {
RunTest("quickview");
}
IN_PROC_BROWSER_TEST_F(FileManagerUITest, UMA) { IN_PROC_BROWSER_TEST_F(FileManagerUITest, UMA) {
RunTest("uma"); RunTest("uma");
} }
......
...@@ -25,7 +25,6 @@ action("create_test_main") { ...@@ -25,7 +25,6 @@ action("create_test_main") {
"crostini_share.js", "crostini_share.js",
"crostini_tasks.js", "crostini_tasks.js",
"js/strings.js", "js/strings.js",
"quick_view.js",
"uma.js", "uma.js",
] ]
args = [ "--output=" + rebase_path(output, root_build_dir) ] args = [ "--output=" + rebase_path(output, root_build_dir) ]
...@@ -41,7 +40,6 @@ js_type_check("closure_compile") { ...@@ -41,7 +40,6 @@ js_type_check("closure_compile") {
":crostini_mount", ":crostini_mount",
":crostini_share", ":crostini_share",
":crostini_tasks", ":crostini_tasks",
":quick_view",
":uma", ":uma",
] ]
} }
...@@ -94,13 +92,6 @@ js_library("crostini_tasks") { ...@@ -94,13 +92,6 @@ js_library("crostini_tasks") {
] ]
} }
js_library("quick_view") {
deps = [
"js:test_util",
"//ui/webui/resources/js:webui_resource_test",
]
}
js_library("uma") { js_library("uma") {
deps = [ deps = [
"js:test_util", "js:test_util",
......
...@@ -240,11 +240,6 @@ test.ENTRIES = { ...@@ -240,11 +240,6 @@ test.ENTRIES = {
test.SharedOption.NONE, 'Sep 30, 2014, 3:30 PM', '.hiddenfile.txt', test.SharedOption.NONE, 'Sep 30, 2014, 3:30 PM', '.hiddenfile.txt',
'51 bytes', 'Plain text'), '51 bytes', 'Plain text'),
mhtml: new test.TestEntryInfo(
test.EntryType.FILE, 'text.txt', 'hello.mhtml', 'text/html',
test.SharedOption.NONE, 'Sep 4, 1998, 12:34 PM', 'hello.mhtml',
'51 bytes', 'HTML document'),
helloInA: new test.TestEntryInfo( helloInA: new test.TestEntryInfo(
test.EntryType.FILE, 'text.txt', 'hello.txt', 'text/plain', test.EntryType.FILE, 'text.txt', 'hello.txt', 'text/plain',
test.SharedOption.NONE, 'Sep 4, 1998, 12:34 PM', 'A/hello.txt', test.SharedOption.NONE, 'Sep 4, 1998, 12:34 PM', 'A/hello.txt',
......
// Copyright 2018 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.
const quickview = {};
/**
* Helper function to open and close Quick View.
* @param {string} file file to open and close.
* @param {function(!Element)=} opt_validate optional validation function that
* receives the QuickView element as argument.
*/
quickview.openCloseQuickView = (file, opt_validate) => {
// Using an image file for testing https://crbug.com/845830.
// If this test starts to take too long on the bots, the image could be
// changed to text file 'hello.txt'.
assertTrue(test.selectFile(file));
// Press Space key.
assertTrue(test.fakeKeyDown('#file-list', ' ', false, false, false));
// Wait until Quick View is displayed and files-safe-media.src is set.
return test
.repeatUntil(() => {
let element = document.querySelector('#quick-view');
if (element && element.shadowRoot) {
element = element.shadowRoot.querySelector('#dialog');
if (getComputedStyle(element).display === 'block' &&
element.querySelector('files-safe-media').src)
return element;
}
return test.pending('Quick View is not opened yet.');
})
.then((result) => {
// Run optional validate.
if (opt_validate)
opt_validate(result);
// Click panel and wait for close.
assertTrue(test.fakeMouseClick(['#quick-view', '#contentPanel']));
return test.repeatUntil(() => {
if (getComputedStyle(result).display === 'none')
return result;
return test.pending('Quick View is not closed yet.');
});
});
};
/**
* Tests opening Quick View for downloads.
*/
quickview.testOpenCloseQuickViewDownloads = (done) => {
test.setupAndWaitUntilReady()
.then(() => {
return quickview.openCloseQuickView('My Desktop Background.png');
})
.then(() => {
// Add hello.mhtml file and verify background is white.
const entriesWithMhtml =
test.BASIC_LOCAL_ENTRY_SET.concat([test.ENTRIES.mhtml]);
test.addEntries(entriesWithMhtml, [], []);
assertTrue(test.fakeMouseClick('#refresh-button'), 'click refresh');
return test.waitForFiles(
test.TestEntryInfo.getExpectedRows(entriesWithMhtml));
})
.then(() => {
return quickview.openCloseQuickView('hello.mhtml', (qv) => {
const htmlPanel = qv.querySelector(
'#innerContentPanel files-safe-media[type="html"]');
const style = window.getComputedStyle(htmlPanel);
// White background is 'rgb(255, 255, 255)'.
assertEquals('rgb(255, 255, 255)', style.backgroundColor, 'bg white');
});
})
.then(() => {
done();
});
};
/**
* Tests opening Quick View for crostini.
*/
quickview.testOpenCloseQuickViewCrostini = (done) => {
test.setupAndWaitUntilReady()
.then(() => {
test.mountCrostini();
return test.waitForElement(
'#directory-tree [volume-type-icon="crostini"]');
})
.then(() => {
assertTrue(test.fakeMouseClick(
'#directory-tree [volume-type-icon="crostini"]'));
return test.waitForFiles(
test.TestEntryInfo.getExpectedRows(test.BASIC_CROSTINI_ENTRY_SET));
})
.then(() => {
return quickview.openCloseQuickView('My Desktop Background.png');
})
.then(() => {
chrome.fileManagerPrivate.removeMount('crostini');
done();
});
};
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