Commit 252973ff authored by Zentaro Kavanagh's avatar Zentaro Kavanagh Committed by Commit Bot

Diagnostics: Add skeleton CPU card

Bug: 1125150
Test: browser_tests --gtest_filter=DiagnosticsApp*
Change-Id: I014cb179d78a34b07caa0eb2c8b3392f8a936248
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419574
Commit-Queue: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808702}
parent 54ed3466
...@@ -80,6 +80,53 @@ suite('DiagnosticsAppTest', () => { ...@@ -80,6 +80,53 @@ suite('DiagnosticsAppTest', () => {
// Verify the memory card is in the page. // Verify the memory card is in the page.
const memory = page.$$('#memoryCard'); const memory = page.$$('#memoryCard');
assertTrue(!!memory); assertTrue(!!memory);
// Verify the CPU card is in the page.
const cpu = page.$$('#cpuCard');
assertTrue(!!cpu);
});
});
suite('CpuCardTest', () => {
/** @type {?HTMLElement} */
let cpuElement = null;
/** @type {?FakeSystemDataProvider} */
let provider = null;
suiteSetup(() => {
provider = new FakeSystemDataProvider();
setSystemDataProviderForTesting(provider);
});
setup(function() {
PolymerTest.clearBody();
});
teardown(function() {
if (cpuElement) {
cpuElement.remove();
}
cpuElement = null;
provider = null;
});
function initializeCpuCard() {
assertFalse(!!cpuElement);
// Add the CPU card to the DOM.
cpuElement = document.createElement('cpu-card');
assertTrue(!!cpuElement);
document.body.appendChild(cpuElement);
return flushTasks();
}
test('CpuCardPopulated', () => {
return initializeCpuCard().then(() => {
// TODO(zentaro): Update when strings are finalized.
assertEquals('CPU', cpuElement.$$('#cardTitle').textContent);
});
}); });
}); });
......
...@@ -10,6 +10,7 @@ import("//tools/polymer/html_to_js.gni") ...@@ -10,6 +10,7 @@ import("//tools/polymer/html_to_js.gni")
js_type_check("closure_compile_module") { js_type_check("closure_compile_module") {
is_polymer3 = true is_polymer3 = true
deps = [ deps = [
":cpu_card",
":diagnostics_app", ":diagnostics_app",
":diagnostics_card", ":diagnostics_card",
":diagnostics_types", ":diagnostics_types",
...@@ -22,8 +23,15 @@ js_type_check("closure_compile_module") { ...@@ -22,8 +23,15 @@ js_type_check("closure_compile_module") {
] ]
} }
js_library("cpu_card") {
deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
]
}
js_library("diagnostics_app") { js_library("diagnostics_app") {
deps = [ deps = [
":cpu_card",
":diagnostics_card", ":diagnostics_card",
":memory_card", ":memory_card",
":overview_card", ":overview_card",
...@@ -76,6 +84,7 @@ js_library("overview_card") { ...@@ -76,6 +84,7 @@ js_library("overview_card") {
html_to_js("web_components") { html_to_js("web_components") {
js_files = [ js_files = [
"cpu_card.js",
"diagnostics_app.js", "diagnostics_app.js",
"diagnostics_card.js", "diagnostics_card.js",
"diagnostics_shared_css.js", "diagnostics_shared_css.js",
......
<style include="diagnostics-shared">
</style>
<diagnostics-card>
<div slot="title">
<!-- TODO(zentaro) Localize once strings are confirmed -->
<div id="cardTitle">CPU</div>
</div>
<div slot="body">
</div>
</diagnostics-card>
// Copyright 2020 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.
import './diagnostics_card.js';
import './diagnostics_shared_css.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {SystemDataProviderInterface} from './diagnostics_types.js'
import {getSystemDataProvider} from './mojo_interface_provider.js';
/**
* @fileoverview
* 'cpu-card' shows information about the CPU.
*/
Polymer({
is: 'cpu-card',
_template: html`{__html_template__}`,
/**
* @private {?SystemDataProviderInterface}
*/
systemDataProvider_: null,
/** @override */
created() {
this.systemDataProvider_ = getSystemDataProvider();
},
});
...@@ -6,4 +6,6 @@ ...@@ -6,4 +6,6 @@
<hr> <hr>
<memory-card id="memoryCard"></memory-card> <memory-card id="memoryCard"></memory-card>
<hr> <hr>
<cpu-card id="cpuCard"></cpu-card>
<hr>
</div> </div>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +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 './cpu_card.js';
import './diagnostics_shared_css.js'; import './diagnostics_shared_css.js';
import './memory_card.js'; import './memory_card.js';
import './overview_card.js'; import './overview_card.js';
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<include name="IDR_DIAGNOSTICS_APP_INDEX_HTML" file="index.html" type="BINDATA" /> <include name="IDR_DIAGNOSTICS_APP_INDEX_HTML" file="index.html" type="BINDATA" />
<include name="IDR_DIAGNOSTICS_APP_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/diagnostics_app.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_APP_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/diagnostics_app.js" use_base_dir="false" type="BINDATA"/>
<include name="IDR_DIAGNOSTICS_CARD_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/diagnostics_card.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_CARD_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/diagnostics_card.js" use_base_dir="false" type="BINDATA"/>
<include name="IDR_DIAGNOSTICS_CPU_CARD_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/cpu_card.js" use_base_dir="false" type="BINDATA"/>
<include name="IDR_DIAGNOSTICS_FAKE_DATA_JS" file="fake_data.js" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_FAKE_DATA_JS" file="fake_data.js" type="BINDATA"/>
<include name="IDR_DIAGNOSTICS_FAKE_METHOD_RESOLVER_JS" file="fake_method_resolver.js" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_FAKE_METHOD_RESOLVER_JS" file="fake_method_resolver.js" type="BINDATA"/>
<include name="IDR_DIAGNOSTICS_FAKE_SYSTEM_DATA_PROVIDER_JS" file="fake_system_data_provider.js" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_FAKE_SYSTEM_DATA_PROVIDER_JS" file="fake_system_data_provider.js" type="BINDATA"/>
......
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