Skip to content

Commit

Permalink
CrOS Settings: Convert tether_connection_dialog browser test to TS
Browse files Browse the repository at this point in the history
Bug: b:270728282
Test: browser_tests --gtest_filter="OSSettingsInternetPageTetherConnectionDialog*"
Change-Id: I3183d5f5ccbdc1992131771192b61b47d5db8088
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342530
Reviewed-by: Wes Okuhara <wesokuhara@google.com>
Commit-Queue: Ilkin Safarli <safarli@google.com>
Cr-Commit-Position: refs/heads/main@{#1117828}
  • Loading branch information
Ilkin Safarli authored and Chromium LUCI CQ committed Mar 15, 2023
1 parent 8c68836 commit 87362ae
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 38 deletions.
1 change: 1 addition & 0 deletions chrome/browser/resources/settings/chromeos/lazy_load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export {TimeZoneAutoDetectMethod} from './date_time_page/date_time_types.js';
export {TimeZoneBrowserProxyImpl} from './date_time_page/timezone_browser_proxy.js';
export {TimezoneSelectorElement} from './date_time_page/timezone_selector.js';
export {CROSTINI_TYPE, GuestOsBrowserProxy, GuestOsBrowserProxyImpl, GuestOsSharedUsbDevice, PLUGIN_VM_TYPE} from './guest_os/guest_os_browser_proxy.js';
export {TetherConnectionDialogElement} from './internet_page/tether_connection_dialog.js';
export {SettingsAudioAndCaptionsPageElement} from './os_a11y_page/audio_and_captions_page.js';
export {SettingsTtsSubpageElement} from './os_a11y_page/tts_subpage.js';
export {SettingsOfficePageElement} from './os_files_page/office_page.js';
Expand Down
3 changes: 2 additions & 1 deletion chrome/test/data/webui/settings/chromeos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ test_files = [
"test_privacy_hub_browser_proxy.js",
"test_profile_info_browser_proxy.js",
"test_select_to_speak_subpage_browser_proxy.js",
"tether_connection_dialog_test.js",
"text_to_speech_page_tests.js",
"text_to_speech_subpage_tests.js",
"timezone_subpage_test.js",
Expand Down Expand Up @@ -214,6 +213,8 @@ test_files = [

"date_time_page/timezone_selector_test.ts",

"internet_page/tether_connection_dialog_test.ts",

"os_a11y_page/audio_and_captions_page_tests.ts",
"os_a11y_page/tts_subpage_test.ts",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://os-settings/chromeos/lazy_load.js';

import {TetherConnectionDialogElement} from 'chrome://os-settings/chromeos/lazy_load.js';
import {OncMojo} from 'chrome://resources/ash/common/network/onc_mojo.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {assertEquals} from 'chrome://webui-test/chai_assert.js';

suite('<tether-connection-dialog>', function() {
let tetherDialog: TetherConnectionDialogElement;

setup(function() {
tetherDialog = document.createElement('tether-connection-dialog');
document.body.appendChild(tetherDialog);
flush();
});

test('Battery percentage', function() {
const managedProperties = OncMojo.getDefaultManagedProperties(
OncMojo.getNetworkTypeFromString('Tether'), 'guid', 'name');
managedProperties.typeProperties.tether!.batteryPercentage = 75;
tetherDialog.managedProperties = managedProperties;
flush();

const batteryEl = tetherDialog.shadowRoot!.querySelector<HTMLElement>(
'#hostDeviceTextBattery');
assertEquals('75% Battery', batteryEl!.innerText.trim());
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ TEST_F('OSSettingsCrostiniExtraContainerPageV3Test', 'AllJsTests', () => {
'InternetPage', 'internet_page_tests.js',
{enabled: ['ash::features::kApnRevamp']}
],
[
'InternetPageTetherConnectionDialog',
'internet_page/tether_connection_dialog_test.js'
],
['InternetSubpage', 'internet_subpage_tests.js'],
['KerberosAccounts', 'kerberos_accounts_test.js'],
['KerberosPage', 'kerberos_page_test.js'],
Expand Down Expand Up @@ -472,7 +476,6 @@ TEST_F('OSSettingsCrostiniExtraContainerPageV3Test', 'AllJsTests', () => {
],
['SwitchAccessSetupGuideDialog', 'switch_access_setup_guide_dialog_test.js'],
['SwitchAccessSubpage', 'switch_access_subpage_tests.js'],
['TetherConnectionDialog', 'tether_connection_dialog_test.js'],
[
'TextToSpeechPage',
'text_to_speech_page_tests.js',
Expand Down

This file was deleted.

0 comments on commit 87362ae

Please sign in to comment.