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() { ...@@ -52,6 +52,34 @@ export function memoryCardTestSuite() {
return flushTasks(); 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', () => { test('MemoryCardPopulated', () => {
return initializeMemoryCard(fakeMemoryUsage).then(() => { return initializeMemoryCard(fakeMemoryUsage).then(() => {
const dataPoints = dx_utils.getDataPointElements(memoryElement); const dataPoints = dx_utils.getDataPointElements(memoryElement);
...@@ -64,6 +92,11 @@ export function memoryCardTestSuite() { ...@@ -64,6 +92,11 @@ export function memoryCardTestSuite() {
fakeMemoryUsage[0].available_memory_kib; fakeMemoryUsage[0].available_memory_kib;
assertEquals(fakeMemoryUsage[0].total_memory_kib, barChart.max); assertEquals(fakeMemoryUsage[0].total_memory_kib, barChart.max);
assertEquals(memInUse, barChart.value); assertEquals(memInUse, barChart.value);
// Verify the routine section is in the card.
assertTrue(!!getRoutineSection());
assertTrue(!!getRunTestsButton());
assertFalse(isRunTestsButtonDisabled());
}); });
}); });
} }
...@@ -14,4 +14,6 @@ ...@@ -14,4 +14,6 @@
header="[[i18n('memoryAvailable')]]" header="[[i18n('memoryAvailable')]]"
value="[[memoryUsage_.available_memory_kib]]"> value="[[memoryUsage_.available_memory_kib]]">
</data-point> </data-point>
<routine-section slot="routines" routines="[[routines_]]"></routine-section>
</diagnostics-card> </diagnostics-card>
...@@ -6,12 +6,13 @@ import './data_point.js'; ...@@ -6,12 +6,13 @@ import './data_point.js';
import './diagnostics_card.js'; import './diagnostics_card.js';
import './diagnostics_shared_css.js'; import './diagnostics_shared_css.js';
import './percent_bar_chart.js'; import './percent_bar_chart.js';
import './routine_section.js'
import './strings.m.js'; import './strings.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.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 {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'; import {getSystemDataProvider} from './mojo_interface_provider.js';
/** /**
...@@ -31,6 +32,16 @@ Polymer({ ...@@ -31,6 +32,16 @@ Polymer({
systemDataProvider_: null, systemDataProvider_: null,
properties: { properties: {
/** @private {!Array<!RoutineName>} */
routines_: {
type: Array,
value: () => {
return [
RoutineName.kMemory,
];
}
},
/** @private {!MemoryUsage} */ /** @private {!MemoryUsage} */
memoryUsage_: { memoryUsage_: {
type: Object, 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