add eslint to keep code consistent
Bug: 236369779 Test: npm run eslint Change-Id: I8c59c8a0ff6b63920ad0298c9625bee9709f2bb6
This commit is contained in:
36
tools/winscope-ng/.eslintrc.js
Normal file
36
tools/winscope-ng/.eslintrc.js
Normal file
@@ -0,0 +1,36 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
2
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
]
|
||||
}
|
||||
};
|
||||
3086
tools/winscope-ng/package-lock.json
generated
3086
tools/winscope-ng/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
"name": "winscope-ng",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"eslint": "npx eslint --ignore-pattern flickerlib src/",
|
||||
"start": "webpack serve --config webpack.config.dev.js --open --hot",
|
||||
"build:kotlin": "rm -rf kotlin_build && npx kotlinc-js -source-map -source-map-embed-sources always -module-kind commonjs -output kotlin_build/flicker.js ../../../platform_testing/libraries/flicker/src/com/android/server/wm/traces/common",
|
||||
"build:prod": "webpack --config webpack.config.prod.js --progress",
|
||||
@@ -46,6 +47,9 @@
|
||||
"@angular/cli": "~14.0.0",
|
||||
"@angular/compiler-cli": "^14.0.0",
|
||||
"@types/jasmine": "~4.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
||||
"@typescript-eslint/parser": "^5.30.6",
|
||||
"eslint": "^8.19.0",
|
||||
"jasmine": "^4.2.1",
|
||||
"jasmine-core": "~4.1.0",
|
||||
"karma": "~6.3.0",
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {AppComponent} from './app.component';
|
||||
import {ComponentFixture, TestBed} from "@angular/core/testing";
|
||||
import {AppComponent} from "./app.component";
|
||||
|
||||
describe("AppComponent", () => {
|
||||
let fixture: ComponentFixture<AppComponent>;
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {Component, Injector, Inject} from '@angular/core';
|
||||
import {createCustomElement} from '@angular/elements';
|
||||
import {ViewerWindowManagerComponent} from 'viewers/viewer_window_manager/viewer_window_manager.component';
|
||||
import {Core} from './core';
|
||||
import {Component, Injector, Inject} from "@angular/core";
|
||||
import {createCustomElement} from "@angular/elements";
|
||||
import {ViewerWindowManagerComponent} from "viewers/viewer_window_manager/viewer_window_manager.component";
|
||||
import {Core} from "./core";
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
selector: "app-root",
|
||||
template: `
|
||||
<div id="title">
|
||||
<span>Winscope Viewer 2.0</span>
|
||||
@@ -41,12 +41,12 @@ import {Core} from './core';
|
||||
`
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'winscope-ng';
|
||||
title = "winscope-ng";
|
||||
|
||||
private core!: Core;
|
||||
|
||||
constructor(@Inject(Injector) injector: Injector) {
|
||||
customElements.define('viewer-window-manager',
|
||||
customElements.define("viewer-window-manager",
|
||||
createCustomElement(ViewerWindowManagerComponent, {injector}));
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export class AppComponent {
|
||||
|
||||
public notifyCurrentTimestamp() {
|
||||
const dummyTimestamp = 1000000; //TODO: get timestamp from time scrub
|
||||
this.core.notifyCurrentTimestamp(dummyTimestamp)
|
||||
this.core.notifyCurrentTimestamp(dummyTimestamp);
|
||||
}
|
||||
|
||||
//TODO: extend with support for multiple files, archives, etc...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from "@angular/core";
|
||||
import { BrowserModule } from "@angular/platform-browser";
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { ViewerWindowManagerComponent} from 'viewers/viewer_window_manager/viewer_window_manager.component';
|
||||
import { AppComponent } from "./app.component";
|
||||
import { ViewerWindowManagerComponent} from "viewers/viewer_window_manager/viewer_window_manager.component";
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from 'parsers/parser'
|
||||
import {ParserFactory} from 'parsers/parser_factory'
|
||||
import {Viewer} from 'viewers/viewer'
|
||||
import {ViewerFactory} from 'viewers/viewer_factory'
|
||||
import {Parser} from "parsers/parser";
|
||||
import {ParserFactory} from "parsers/parser_factory";
|
||||
import {Viewer} from "viewers/viewer";
|
||||
import {ViewerFactory} from "viewers/viewer_factory";
|
||||
|
||||
class Core {
|
||||
private parsers: Parser[];
|
||||
@@ -69,7 +69,7 @@ class Core {
|
||||
|
||||
this.viewers.forEach(viewer => {
|
||||
viewer.notifyCurrentTraceEntries(traceEntries);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {StringUtils} from "common/utils/string_utils"
|
||||
import {StringUtils} from "common/utils/string_utils";
|
||||
import configJson from "../../../../../../frameworks/base/data/etc/services.core.protolog.json";
|
||||
|
||||
class LogMessage {
|
||||
@@ -38,17 +38,17 @@ class FormattedLogMessage extends LogMessage {
|
||||
constructor(proto: any) {
|
||||
const text = (
|
||||
proto.messageHash.toString() +
|
||||
' - [' + proto.strParams.toString() +
|
||||
'] [' + proto.sint64Params.toString() +
|
||||
'] [' + proto.doubleParams.toString() +
|
||||
'] [' + proto.booleanParams.toString() + ']'
|
||||
" - [" + proto.strParams.toString() +
|
||||
"] [" + proto.sint64Params.toString() +
|
||||
"] [" + proto.doubleParams.toString() +
|
||||
"] [" + proto.booleanParams.toString() + "]"
|
||||
);
|
||||
super(
|
||||
text,
|
||||
StringUtils.nanosecondsToHuman(proto.elapsedRealtimeNanos),
|
||||
'INVALID',
|
||||
'invalid',
|
||||
'',
|
||||
"INVALID",
|
||||
"invalid",
|
||||
"",
|
||||
Number(proto.elapsedRealtimeNanos));
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class UnformattedLogMessage extends LogMessage {
|
||||
}
|
||||
|
||||
function formatText(messageFormat: any, data: any) {
|
||||
let out = '';
|
||||
let out = "";
|
||||
|
||||
const strParams: string[] = data.strParams;
|
||||
let strParamsIdx = 0;
|
||||
@@ -79,42 +79,42 @@ function formatText(messageFormat: any, data: any) {
|
||||
let booleanParamsIdx = 0;
|
||||
|
||||
for (let i = 0; i < messageFormat.length;) {
|
||||
if (messageFormat[i] == '%') {
|
||||
if (messageFormat[i] == "%") {
|
||||
if (i + 1 >= messageFormat.length) {
|
||||
// Should never happen - protologtool checks for that
|
||||
throw new Error('Invalid format string');
|
||||
throw new Error("Invalid format string");
|
||||
}
|
||||
switch (messageFormat[i + 1]) {
|
||||
case '%':
|
||||
out += '%';
|
||||
break;
|
||||
case 'd':
|
||||
out += getParam(sint64Params, sint64ParamsIdx++).toString(10);
|
||||
break;
|
||||
case 'o':
|
||||
out += getParam(sint64Params, sint64ParamsIdx++).toString(8);
|
||||
break;
|
||||
case 'x':
|
||||
out += getParam(sint64Params, sint64ParamsIdx++).toString(16);
|
||||
break;
|
||||
case 'f':
|
||||
out += getParam(doubleParams, doubleParamsIdx++).toFixed(6);
|
||||
break;
|
||||
case 'e':
|
||||
out += getParam(doubleParams, doubleParamsIdx++).toExponential();
|
||||
break;
|
||||
case 'g':
|
||||
out += getParam(doubleParams, doubleParamsIdx++).toString();
|
||||
break;
|
||||
case 's':
|
||||
out += getParam(strParams, strParamsIdx++);
|
||||
break;
|
||||
case 'b':
|
||||
out += getParam(booleanParams, booleanParamsIdx++).toString();
|
||||
break;
|
||||
default:
|
||||
// Should never happen - protologtool checks for that
|
||||
throw new Error('Invalid format string conversion: ' +
|
||||
case "%":
|
||||
out += "%";
|
||||
break;
|
||||
case "d":
|
||||
out += getParam(sint64Params, sint64ParamsIdx++).toString(10);
|
||||
break;
|
||||
case "o":
|
||||
out += getParam(sint64Params, sint64ParamsIdx++).toString(8);
|
||||
break;
|
||||
case "x":
|
||||
out += getParam(sint64Params, sint64ParamsIdx++).toString(16);
|
||||
break;
|
||||
case "f":
|
||||
out += getParam(doubleParams, doubleParamsIdx++).toFixed(6);
|
||||
break;
|
||||
case "e":
|
||||
out += getParam(doubleParams, doubleParamsIdx++).toExponential();
|
||||
break;
|
||||
case "g":
|
||||
out += getParam(doubleParams, doubleParamsIdx++).toString();
|
||||
break;
|
||||
case "s":
|
||||
out += getParam(strParams, strParamsIdx++);
|
||||
break;
|
||||
case "b":
|
||||
out += getParam(booleanParams, booleanParamsIdx++).toString();
|
||||
break;
|
||||
default:
|
||||
// Should never happen - protologtool checks for that
|
||||
throw new Error("Invalid format string conversion: " +
|
||||
messageFormat[i + 1]);
|
||||
}
|
||||
i += 2;
|
||||
@@ -128,7 +128,7 @@ function formatText(messageFormat: any, data: any) {
|
||||
|
||||
function getParam<T>(arr: T[], idx: number): T {
|
||||
if (arr.length <= idx) {
|
||||
throw new Error('No param for format string conversion');
|
||||
throw new Error("No param for format string conversion");
|
||||
}
|
||||
return arr[idx];
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ class ScreenRecordingTraceEntry {
|
||||
public videoTimeSeconds: number,
|
||||
public videoData: Blob) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export {ScreenRecordingTraceEntry};
|
||||
|
||||
@@ -30,6 +30,6 @@ enum TraceTypeId {
|
||||
INPUT_METHOD_SERVICE,
|
||||
TAG,
|
||||
ERROR,
|
||||
};
|
||||
}
|
||||
|
||||
export {TraceTypeId};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {ArrayUtils} from './array_utils';
|
||||
import {ArrayUtils} from "./array_utils";
|
||||
|
||||
describe("ArrayUtils", () => {
|
||||
it("equal", () => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {StringUtils} from './string_utils';
|
||||
import {StringUtils} from "./string_utils";
|
||||
|
||||
describe("StringUtils", () => {
|
||||
it("nanosecondsToHuman", () => {
|
||||
|
||||
@@ -36,7 +36,7 @@ class StringUtils {
|
||||
}
|
||||
}
|
||||
|
||||
return parts.reverse().join('');
|
||||
return parts.reverse().join("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
|
||||
import "zone.js";
|
||||
import "zone.js/testing";
|
||||
import {TestBed} from "@angular/core/testing";
|
||||
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from "@angular/platform-browser-dynamic/testing";
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
@@ -31,5 +31,5 @@ TestBed.initTestEnvironment(
|
||||
);
|
||||
|
||||
// load all tests of Angular components
|
||||
const context = require.context('./', true, /\.component\.spec\.ts$/);
|
||||
const context = require.context("./", true, /\.component\.spec\.ts$/);
|
||||
context.keys().forEach(context);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {ArrayUtils} from '../common/utils/array_utils';
|
||||
import {ArrayUtils} from "../common/utils/array_utils";
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
|
||||
abstract class Parser {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from "./parser"
|
||||
import {ParserFactory} from './parser_factory';
|
||||
import {Parser} from "./parser";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
import {TestUtils} from "test/test_utils";
|
||||
|
||||
describe("ParserAccessibility", () => {
|
||||
@@ -39,6 +39,6 @@ describe("ParserAccessibility", () => {
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
expect(Number(parser.getTraceEntry(850297444302)!.elapsedRealtimeNanos))
|
||||
.toEqual(850297444302);
|
||||
.toEqual(850297444302);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {AccessibilityTraceFileProto} from './proto_types';
|
||||
import {Parser} from "./parser";
|
||||
import {AccessibilityTraceFileProto} from "./proto_types";
|
||||
|
||||
class ParserAccessibility extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -35,26 +35,26 @@ describe("Parser", () => {
|
||||
|
||||
it("retrieves trace entry (no timestamp matches)", () => {
|
||||
expect(parser.getTraceEntry(850254319342))
|
||||
.toEqual(undefined);
|
||||
.toEqual(undefined);
|
||||
});
|
||||
|
||||
it("retrieves trace entry (equal timestamp matches)", () => {
|
||||
expect(Number(parser.getTraceEntry(850254319343)!.timestampMs))
|
||||
.toEqual(850254319343);
|
||||
.toEqual(850254319343);
|
||||
});
|
||||
|
||||
it("retrieves trace entry (equal timestamp matches)", () => {
|
||||
expect(Number(parser.getTraceEntry(850763506110)!.timestampMs))
|
||||
.toEqual(850763506110);
|
||||
.toEqual(850763506110);
|
||||
});
|
||||
|
||||
it("retrieves trace entry (lower timestamp matches)", () => {
|
||||
expect(Number(parser.getTraceEntry(850254319344)!.timestampMs))
|
||||
.toEqual(850254319343);
|
||||
.toEqual(850254319343);
|
||||
});
|
||||
|
||||
it("retrieves trace entry (equal timestamp matches)", () => {
|
||||
expect(Number(parser.getTraceEntry(850763506111)!.timestampMs))
|
||||
.toEqual(850763506110);
|
||||
.toEqual(850763506110);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,12 +18,12 @@ import {ParserAccessibility} from "./parser_accessibility";
|
||||
import {ParserInputMethodClients} from "./parser_input_method_clients";
|
||||
import {ParserInputMethodManagerService} from "./parser_input_method_manager_service";
|
||||
import {ParserInputMethodService} from "./parser_input_method_service";
|
||||
import {ParserProtoLog} from "./parser_protolog"
|
||||
import {ParserScreenRecording} from "./parser_screen_recording"
|
||||
import {ParserSurfaceFlinger} from "./parser_surface_flinger"
|
||||
import {ParserProtoLog} from "./parser_protolog";
|
||||
import {ParserScreenRecording} from "./parser_screen_recording";
|
||||
import {ParserSurfaceFlinger} from "./parser_surface_flinger";
|
||||
import {ParserTransactions} from "./parser_transactions";
|
||||
import {ParserWindowManager} from "./parser_window_manager"
|
||||
import {ParserWindowManagerDump} from "./parser_window_manager_dump"
|
||||
import {ParserWindowManager} from "./parser_window_manager";
|
||||
import {ParserWindowManagerDump} from "./parser_window_manager_dump";
|
||||
|
||||
class ParserFactory {
|
||||
static readonly PARSERS = [
|
||||
@@ -37,19 +37,23 @@ class ParserFactory {
|
||||
ParserTransactions,
|
||||
ParserWindowManager,
|
||||
ParserWindowManagerDump,
|
||||
]
|
||||
];
|
||||
|
||||
async createParsers(traces: Blob[]): Promise<Parser[]> {
|
||||
const parsers: Parser[] = [];
|
||||
|
||||
for (const trace of traces) {
|
||||
for (const [index, trace] of traces.entries()) {
|
||||
console.log(`Loading trace #${index}`);
|
||||
for (const ParserType of ParserFactory.PARSERS) {
|
||||
try {
|
||||
const parser = new ParserType(trace);
|
||||
await parser.parse();
|
||||
parsers.push(parser);
|
||||
console.log(`Successfully loaded trace with parser type ${ParserType.name}`);
|
||||
break;
|
||||
} catch(error) {
|
||||
}
|
||||
catch(error) {
|
||||
console.log(`Failed to load trace with parser type ${ParserType.name}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,6 @@ describe("ParserInputMethodlClients", () => {
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
expect(Number(parser.getTraceEntry(1149083651642)!.elapsedRealtimeNanos))
|
||||
.toEqual(1149083651642);
|
||||
.toEqual(1149083651642);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {InputMethodClientsTraceFileProto} from './proto_types';
|
||||
import {Parser} from "./parser";
|
||||
import {InputMethodClientsTraceFileProto} from "./proto_types";
|
||||
|
||||
class ParserInputMethodClients extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -39,6 +39,6 @@ describe("ParserInputMethodManagerService", () => {
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
expect(Number(parser.getTraceEntry(1149226290110)!.elapsedRealtimeNanos))
|
||||
.toEqual(1149226290110);
|
||||
.toEqual(1149226290110);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {InputMethodManagerServiceTraceFileProto} from './proto_types';
|
||||
import {Parser} from "./parser";
|
||||
import {InputMethodManagerServiceTraceFileProto} from "./proto_types";
|
||||
|
||||
class ParserInputMethodManagerService extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -39,6 +39,6 @@ describe("ParserInputMethodService", () => {
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
expect(Number(parser.getTraceEntry(1149230019887)!.elapsedRealtimeNanos))
|
||||
.toEqual(1149230019887);
|
||||
.toEqual(1149230019887);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {InputMethodServiceTraceFileProto} from './proto_types';
|
||||
import {Parser} from "./parser";
|
||||
import {InputMethodServiceTraceFileProto} from "./proto_types";
|
||||
|
||||
class ParserInputMethodService extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import {TraceTypeId} from "common/trace/type_id";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
import {Parser} from "./parser";
|
||||
import {TestUtils} from "test/test_utils";
|
||||
import {LogMessage} from '../common/trace/protolog';
|
||||
import {LogMessage} from "../common/trace/protolog";
|
||||
|
||||
describe("ParserProtoLog", () => {
|
||||
let parser: Parser;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import {LogMessage, FormattedLogMessage, UnformattedLogMessage} from "common/trace/protolog";
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from "./parser"
|
||||
import {Parser} from "./parser";
|
||||
import {ProtoLogFileProto} from "./proto_types";
|
||||
import configJson from "../../../../../frameworks/base/data/etc/services.core.protolog.json";
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
import {ScreenRecordingTraceEntry} from "common/trace/screen_recording";
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {TestUtils} from 'test/test_utils';
|
||||
import {Parser} from './parser';
|
||||
import {ParserFactory} from './parser_factory';
|
||||
import {TestUtils} from "test/test_utils";
|
||||
import {Parser} from "./parser";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
|
||||
describe("ParserScreenRecording", () => {
|
||||
let parser: Parser;
|
||||
@@ -48,13 +48,13 @@ describe("ParserScreenRecording", () => {
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
{
|
||||
const entry = parser.getTraceEntry(19446131807000)!
|
||||
const entry = parser.getTraceEntry(19446131807000)!;
|
||||
expect(entry).toBeInstanceOf(ScreenRecordingTraceEntry);
|
||||
expect(Number(entry.videoTimeSeconds)).toBeCloseTo(0);
|
||||
}
|
||||
|
||||
{
|
||||
const entry = parser.getTraceEntry(19448501007000)!
|
||||
const entry = parser.getTraceEntry(19448501007000)!;
|
||||
expect(entry).toBeInstanceOf(ScreenRecordingTraceEntry);
|
||||
expect(Number(entry.videoTimeSeconds)).toBeCloseTo(2.37, 0.001);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {ArrayUtils} from "common/utils/array_utils";
|
||||
import {Parser} from "./parser"
|
||||
import {Parser} from "./parser";
|
||||
import {ScreenRecordingTraceEntry} from "common/trace/screen_recording";
|
||||
|
||||
class ParserScreenRecording extends Parser {
|
||||
@@ -32,8 +32,8 @@ class ParserScreenRecording extends Parser {
|
||||
}
|
||||
|
||||
override decodeTrace(videoData: Uint8Array): number[] {
|
||||
let posCount = this.searchMagicString(videoData);
|
||||
let [posTimestamps, count] = this.parseTimestampsCount(videoData, posCount);
|
||||
const posCount = this.searchMagicString(videoData);
|
||||
const [posTimestamps, count] = this.parseTimestampsCount(videoData, posCount);
|
||||
return this.parseTimestamps(videoData, posTimestamps, count);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {LayerTraceEntry} from 'common/trace/flickerlib/layers/LayerTraceEntry';
|
||||
import {TestUtils} from 'test/test_utils';
|
||||
import {Parser} from './parser';
|
||||
import {ParserFactory} from './parser_factory';
|
||||
import {LayerTraceEntry} from "common/trace/flickerlib/layers/LayerTraceEntry";
|
||||
import {TestUtils} from "test/test_utils";
|
||||
import {Parser} from "./parser";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
|
||||
describe("ParserSurfaceFlinger", () => {
|
||||
let parser: Parser;
|
||||
@@ -39,7 +39,7 @@ describe("ParserSurfaceFlinger", () => {
|
||||
});
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
const entry = parser.getTraceEntry(850335483446)!
|
||||
const entry = parser.getTraceEntry(850335483446)!;
|
||||
expect(entry).toBeInstanceOf(LayerTraceEntry);
|
||||
expect(Number(entry.timestampMs)).toEqual(850335483446);
|
||||
});
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {LayerTraceEntry} from 'common/trace/flickerlib/layers/LayerTraceEntry';
|
||||
import {LayerTraceEntry} from "common/trace/flickerlib/layers/LayerTraceEntry";
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {LayersTraceFileProto} from './proto_types';
|
||||
import {Parser} from "./parser";
|
||||
import {LayersTraceFileProto} from "./proto_types";
|
||||
|
||||
class ParserSurfaceFlinger extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {LayerTraceEntry} from 'common/trace/flickerlib/layers/LayerTraceEntry';
|
||||
import {TestUtils} from 'test/test_utils';
|
||||
import {Parser} from './parser';
|
||||
import {ParserFactory} from './parser_factory';
|
||||
import {LayerTraceEntry} from "common/trace/flickerlib/layers/LayerTraceEntry";
|
||||
import {TestUtils} from "test/test_utils";
|
||||
import {Parser} from "./parser";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
|
||||
describe("ParserSurfaceFlingerDump", () => {
|
||||
let parser: Parser;
|
||||
@@ -38,7 +38,7 @@ describe("ParserSurfaceFlingerDump", () => {
|
||||
});
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
const entry = parser.getTraceEntry(0)!
|
||||
const entry = parser.getTraceEntry(0)!;
|
||||
expect(entry).toBeInstanceOf(LayerTraceEntry);
|
||||
expect(Number(entry.timestampMs)).toEqual(0);
|
||||
});
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from "./parser"
|
||||
import {ParserFactory} from './parser_factory';
|
||||
import {Parser} from "./parser";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
import {TestUtils} from "test/test_utils";
|
||||
|
||||
describe("ParserTransactions", () => {
|
||||
@@ -42,6 +42,6 @@ describe("ParserTransactions", () => {
|
||||
|
||||
it("retrieves trace entry", () => {
|
||||
expect(Number(parser.getTraceEntry(14862317023)!.elapsedRealtimeNanos))
|
||||
.toEqual(14862317023);
|
||||
.toEqual(14862317023);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {TransactionsTraceFileProto} from './proto_types';
|
||||
import {Parser} from "./parser";
|
||||
import {TransactionsTraceFileProto} from "./proto_types";
|
||||
|
||||
class ParserTransactions extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {WindowManagerState} from 'common/trace/flickerlib/windows/WindowManagerState';
|
||||
import {WindowManagerState} from "common/trace/flickerlib/windows/WindowManagerState";
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
import {Parser} from "./parser";
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {WindowManagerTraceFileProto} from './proto_types';
|
||||
import {WindowManagerState} from 'common/trace/flickerlib/windows/WindowManagerState';
|
||||
import {Parser} from "./parser";
|
||||
import {WindowManagerTraceFileProto} from "./proto_types";
|
||||
import {WindowManagerState} from "common/trace/flickerlib/windows/WindowManagerState";
|
||||
|
||||
class ParserWindowManager extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {WindowManagerState} from 'common/trace/flickerlib/windows/WindowManagerState';
|
||||
import {WindowManagerState} from "common/trace/flickerlib/windows/WindowManagerState";
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {ParserFactory} from "./parser_factory";
|
||||
import {Parser} from "./parser";
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Parser} from './parser'
|
||||
import {WindowManagerServiceDumpProto} from './proto_types';
|
||||
import {WindowManagerState} from 'common/trace/flickerlib/windows/WindowManagerState';
|
||||
import {Parser} from "./parser";
|
||||
import {WindowManagerServiceDumpProto} from "./proto_types";
|
||||
import {WindowManagerState} from "common/trace/flickerlib/windows/WindowManagerState";
|
||||
|
||||
class ParserWindowManagerDump extends Parser {
|
||||
constructor(trace: Blob) {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
import "zone.js"; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
|
||||
@@ -24,7 +24,7 @@ class Blob {
|
||||
|
||||
arrayBuffer(): Promise<ArrayBuffer> {
|
||||
return new Promise<ArrayBuffer>((resolve, reject) => {
|
||||
resolve(this.buffer);
|
||||
resolve(this.buffer);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {browser, element, by} from 'protractor';
|
||||
import {TestUtils} from '../test_utils';
|
||||
import {browser, element, by} from "protractor";
|
||||
import {TestUtils} from "../test_utils";
|
||||
|
||||
describe("Viewer WindowManager", () => {
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {browser, element, by} from 'protractor';
|
||||
import {TestUtils} from "../test_utils"
|
||||
import {browser, element, by} from "protractor";
|
||||
import {TestUtils} from "../test_utils";
|
||||
|
||||
describe("winscope", () => {
|
||||
beforeAll(() => {
|
||||
@@ -24,5 +24,5 @@ describe("winscope", () => {
|
||||
it("has title", () => {
|
||||
const title = element(by.css("#title"));
|
||||
expect(title.getText()).toContain("Winscope");
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TraceTypeId } from "common/trace/type_id"
|
||||
import { TraceTypeId } from "common/trace/type_id";
|
||||
|
||||
interface Viewer {
|
||||
//TODO: add TraceEntry data type
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TraceTypeId } from "common/trace/type_id";
|
||||
import { Viewer } from './viewer';
|
||||
import { ViewerWindowManager } from './viewer_window_manager/viewer_window_manager';
|
||||
import { Viewer } from "./viewer";
|
||||
import { ViewerWindowManager } from "./viewer_window_manager/viewer_window_manager";
|
||||
|
||||
class ViewerFactory {
|
||||
static readonly VIEWERS = [
|
||||
ViewerWindowManager,
|
||||
]
|
||||
];
|
||||
|
||||
public createViewers(activeTraceTypes: Set<TraceTypeId>): Viewer[] {
|
||||
const viewers: Viewer[] = [];
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {UiData} from "./ui_data"
|
||||
import {UiData} from "./ui_data";
|
||||
|
||||
type UiDataCallbackType = (uiData: UiData) => void;
|
||||
|
||||
@@ -39,6 +39,6 @@ class Presenter {
|
||||
|
||||
private readonly uiDataCallback: UiDataCallbackType;
|
||||
private uiData?: UiData;
|
||||
};
|
||||
}
|
||||
|
||||
export {Presenter, UiDataCallbackType};
|
||||
|
||||
@@ -32,13 +32,13 @@ import {UiData} from "./ui_data";
|
||||
})
|
||||
export class ViewerWindowManagerComponent {
|
||||
@Input()
|
||||
inputData?: UiData;
|
||||
inputData?: UiData;
|
||||
|
||||
@Output()
|
||||
outputEvent = new EventEmitter<DummyEvent>(); // or EventEmitter<void>()
|
||||
outputEvent = new EventEmitter<DummyEvent>(); // or EventEmitter<void>()
|
||||
|
||||
public generateOutputEvent(event: MouseEvent) {
|
||||
this.outputEvent.emit(new DummyEvent())
|
||||
this.outputEvent.emit(new DummyEvent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import {TraceTypeId} from "common/trace/type_id";
|
||||
import {Viewer} from "viewers/viewer";
|
||||
import {Presenter} from "./presenter"
|
||||
import {Presenter} from "./presenter";
|
||||
import {UiData} from "./ui_data";
|
||||
|
||||
class ViewerWindowManager implements Viewer {
|
||||
|
||||
Reference in New Issue
Block a user