Commit 32258f41 authored by Zentaro Kavanagh's avatar Zentaro Kavanagh Committed by Commit Bot

Diagnostics: Add memory routines to card

Bug: 1125150
Test: browser_tests --gtest_filter=DiagnosticsApp*
Change-Id: I0ff55e17f4b2dd73517509b1521297f582113665
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518324
Commit-Queue: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823822}
parent 60c3fa89
......@@ -52,6 +52,34 @@ export function memoryCardTestSuite() {
return flushTasks();
}
/**
* Returns the routine-section from the card.
* @return {!RoutineSection}
*/
function getRoutineSection() {
const routineSection = memoryElement.$$('routine-section');
assertTrue(!!routineSection);
return routineSection;
}
/**
* Returns the Run Tests button from inside the routine-section.
* @return {!CrButton}
*/
function getRunTestsButton() {
const button = dx_utils.getRunTestsButtonFromSection(getRoutineSection());
assertTrue(!!button);
return button;
}
/**
* Returns whether the run tests button is disabled.
* @return {bool}
*/
function isRunTestsButtonDisabled() {
return getRunTestsButton().disabled;
}
test('MemoryCardPopulated', () => {
return initializeMemoryCard(fakeMemoryUsage).then(() => {
const dataPoints = dx_utils.getDataPointElements(memoryElement);
......@@ -64,6 +92,11 @@ export function memoryCardTestSuite() {
fakeMemoryUsage[0].available_memory_kib;
assertEquals(fakeMemoryUsage[0].total_memory_kib, barChart.max);
assertEquals(memInUse, barChart.value);
// Verify the routine section is in the card.
assertTrue(!!getRoutineSection());
assertTrue(!!getRunTestsButton());
assertFalse(isRunTestsButtonDisabled());
});
});
}
......@@ -14,4 +14,6 @@
header="[[i18n('memoryAvailable')]]"
value="[[memoryUsage_.available_memory_kib]]">
</data-point>
<routine-section slot="routines" routines="[[routines_]]"></routine-section>
</diagnostics-card>
......@@ -6,12 +6,13 @@ import './data_point.js';
import './diagnostics_card.js';
import './diagnostics_shared_css.js';
import './percent_bar_chart.js';
import './routine_section.js'
import './strings.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {MemoryUsage, SystemDataProviderInterface} from './diagnostics_types.js'
import {MemoryUsage, RoutineName, SystemDataProviderInterface} from './diagnostics_types.js'
import {getSystemDataProvider} from './mojo_interface_provider.js';
/**
......@@ -31,6 +32,16 @@ Polymer({
systemDataProvider_: null,
properties: {
/** @private {!Array<!RoutineName>} */
routines_: {
type: Array,
value: () => {
return [
RoutineName.kMemory,
];
}
},
/** @private {!MemoryUsage} */
memoryUsage_: {
type: Object,
......
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