Commit a49262da authored by Gavin Williams's avatar Gavin Williams Committed by Commit Bot

scanning: Fix test imports

Import specific functions from scanning_app_test_utils

Import the appropriate Scanning subpage for each test.

Bug: 1059779
Change-Id: I9d0470a8955a892fa3820e55544097576e9c2118
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522111
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Reviewed-by: default avatarJesse Schettler <jschettler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824731}
parent 251ec79d
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/color_mode_select.js';
import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {getColorModeString} from 'chrome://scanning/scanning_app_util.js'; import {getColorModeString} from 'chrome://scanning/scanning_app_util.js';
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/file_type_select.js';
import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/page_size_select.js';
import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {getPageSizeString} from 'chrome://scanning/scanning_app_util.js'; import {getPageSizeString} from 'chrome://scanning/scanning_app_util.js';
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/resolution_select.js';
import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/scan_to_select.js';
import 'chrome://scanning/scanning_app.js';
import {ScanningBrowserProxyImpl} from 'chrome://scanning/scanning_browser_proxy.js'; import {ScanningBrowserProxyImpl} from 'chrome://scanning/scanning_browser_proxy.js';
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/scanner_select.js';
import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {ScannerArr} from 'chrome://scanning/scanning_app_types.js'; import {ScannerArr} from 'chrome://scanning/scanning_app_types.js';
...@@ -11,7 +10,7 @@ import {tokenToString} from 'chrome://scanning/scanning_app_util.js'; ...@@ -11,7 +10,7 @@ import {tokenToString} from 'chrome://scanning/scanning_app_util.js';
import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js';
import * as utils from './scanning_app_test_utils.js'; import {createScanner} from './scanning_app_test_utils.js';
const firstScannerId = const firstScannerId =
/** @type {!mojoBase.mojom.UnguessableToken} */ ({high: 0, low: 1}); /** @type {!mojoBase.mojom.UnguessableToken} */ ({high: 0, low: 1});
...@@ -49,8 +48,8 @@ export function scannerSelectTest() { ...@@ -49,8 +48,8 @@ export function scannerSelectTest() {
assertFalse(throbber.hidden); assertFalse(throbber.hidden);
const scannerArr = [ const scannerArr = [
utils.createScanner(firstScannerId, firstScannerName), createScanner(firstScannerId, firstScannerName),
utils.createScanner(secondScannerId, secondScannerName) createScanner(secondScannerId, secondScannerName)
]; ];
scannerSelect.scanners = scannerArr; scannerSelect.scanners = scannerArr;
scannerSelect.loaded = true; scannerSelect.loaded = true;
...@@ -71,7 +70,7 @@ export function scannerSelectTest() { ...@@ -71,7 +70,7 @@ export function scannerSelectTest() {
const select = scannerSelect.$$('select'); const select = scannerSelect.$$('select');
assertTrue(!!select); assertTrue(!!select);
let scannerArr = [utils.createScanner(firstScannerId, firstScannerName)]; let scannerArr = [createScanner(firstScannerId, firstScannerName)];
scannerSelect.scanners = scannerArr; scannerSelect.scanners = scannerArr;
scannerSelect.loaded = true; scannerSelect.loaded = true;
flush(); flush();
...@@ -80,8 +79,8 @@ export function scannerSelectTest() { ...@@ -80,8 +79,8 @@ export function scannerSelectTest() {
assertEquals(1, select.length); assertEquals(1, select.length);
assertTrue(select.disabled); assertTrue(select.disabled);
scannerArr = scannerArr.concat( scannerArr =
[utils.createScanner(secondScannerId, secondScannerName)]); scannerArr.concat([createScanner(secondScannerId, secondScannerName)]);
scannerSelect.scanners = scannerArr; scannerSelect.scanners = scannerArr;
flush(); flush();
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js';
import 'chrome://scanning/scanning_app.js'; import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
...@@ -13,7 +12,7 @@ import {tokenToString} from 'chrome://scanning/scanning_app_util.js'; ...@@ -13,7 +12,7 @@ import {tokenToString} from 'chrome://scanning/scanning_app_util.js';
import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js';
import {flushTasks} from '../../test_util.m.js'; import {flushTasks} from '../../test_util.m.js';
import * as utils from './scanning_app_test_utils.js'; import {createScanner, createScannerSource} from './scanning_app_test_utils.js';
const ColorMode = { const ColorMode = {
BLACK_AND_WHITE: chromeos.scanning.mojom.ColorMode.kBlackAndWhite, BLACK_AND_WHITE: chromeos.scanning.mojom.ColorMode.kBlackAndWhite,
...@@ -226,21 +225,20 @@ export function scanningAppTest() { ...@@ -226,21 +225,20 @@ export function scanningAppTest() {
const secondScannerName = 'Scanner 2'; const secondScannerName = 'Scanner 2';
const expectedScanners = [ const expectedScanners = [
utils.createScanner(firstScannerId, firstScannerName), createScanner(firstScannerId, firstScannerName),
utils.createScanner(secondScannerId, secondScannerName) createScanner(secondScannerId, secondScannerName)
]; ];
const firstCapabilities = { const firstCapabilities = {
sources: [ sources: [
utils.createScannerSource(SourceType.FLATBED, 'platen', pageSizes), createScannerSource(SourceType.FLATBED, 'platen', pageSizes),
utils.createScannerSource( createScannerSource(SourceType.ADF_DUPLEX, 'adf duplex', pageSizes),
SourceType.ADF_DUPLEX, 'adf duplex', pageSizes),
], ],
colorModes: [ColorMode.BLACK_AND_WHITE, ColorMode.COLOR], colorModes: [ColorMode.BLACK_AND_WHITE, ColorMode.COLOR],
resolutions: [75, 100, 300] resolutions: [75, 100, 300]
}; };
const secondCapabilities = { const secondCapabilities = {
sources: [utils.createScannerSource( sources: [createScannerSource(
SourceType.ADF_SIMPLEX, 'adf simplex', pageSizes)], SourceType.ADF_SIMPLEX, 'adf simplex', pageSizes)],
colorModes: [ColorMode.GRAYSCALE], colorModes: [ColorMode.GRAYSCALE],
resolutions: [150, 600] resolutions: [150, 600]
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
// TODO(jschettler): Use es6 module for mojo binding (crbug/1004256). // TODO(jschettler): Use es6 module for mojo binding (crbug/1004256).
import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/big_buffer.mojom-lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import 'chrome://scanning/file_path.mojom-lite.js';
import 'chrome://scanning/scanning.mojom-lite.js';
import {colorModeSelectTest} from './color_mode_select_test.js'; import {colorModeSelectTest} from './color_mode_select_test.js';
import {fileTypeSelectTest} from './file_type_select_test.js'; import {fileTypeSelectTest} from './file_type_select_test.js';
......
...@@ -2,15 +2,14 @@ ...@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://scanning/scan_preview.js'; import 'chrome://scanning/source_select.js';
import 'chrome://scanning/scanning_app.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {getSourceTypeString} from 'chrome://scanning/scanning_app_util.js'; import {getSourceTypeString} from 'chrome://scanning/scanning_app_util.js';
import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js';
import * as utils from './scanning_app_test_utils.js'; import {createScannerSource} from './scanning_app_test_utils.js';
const FileType = { const FileType = {
JPG: chromeos.scanning.mojom.FileType.kJpg, JPG: chromeos.scanning.mojom.FileType.kJpg,
...@@ -56,9 +55,9 @@ export function sourceSelectTest() { ...@@ -56,9 +55,9 @@ export function sourceSelectTest() {
assertEquals(0, select.length); assertEquals(0, select.length);
const firstSource = const firstSource =
utils.createScannerSource(SourceType.FLATBED, 'platen', pageSizes); createScannerSource(SourceType.FLATBED, 'platen', pageSizes);
const secondSource = utils.createScannerSource( const secondSource =
SourceType.ADF_SIMPLEX, 'adf simplex', pageSizes); createScannerSource(SourceType.ADF_SIMPLEX, 'adf simplex', pageSizes);
const sourceArr = [firstSource, secondSource]; const sourceArr = [firstSource, secondSource];
sourceSelect.sources = sourceArr; sourceSelect.sources = sourceArr;
flush(); flush();
...@@ -81,7 +80,7 @@ export function sourceSelectTest() { ...@@ -81,7 +80,7 @@ export function sourceSelectTest() {
assertTrue(!!select); assertTrue(!!select);
let sourceArr = let sourceArr =
[utils.createScannerSource(SourceType.FLATBED, 'flatbed', pageSizes)]; [createScannerSource(SourceType.FLATBED, 'flatbed', pageSizes)];
sourceSelect.sources = sourceArr; sourceSelect.sources = sourceArr;
flush(); flush();
...@@ -89,8 +88,8 @@ export function sourceSelectTest() { ...@@ -89,8 +88,8 @@ export function sourceSelectTest() {
assertEquals(1, select.length); assertEquals(1, select.length);
assertTrue(select.disabled); assertTrue(select.disabled);
sourceArr = sourceArr.concat([utils.createScannerSource( sourceArr = sourceArr.concat(
SourceType.ADF_DUPLEX, 'adf duplex', pageSizes)]); [createScannerSource(SourceType.ADF_DUPLEX, 'adf duplex', pageSizes)]);
sourceSelect.sources = sourceArr; sourceSelect.sources = sourceArr;
flush(); flush();
......
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