• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import {browser, by, element} from 'protractor';
18import {E2eTestUtils} from './utils';
19
20describe('Viewer Surface Flinger', () => {
21  const viewerSelector = 'viewer-surface-flinger';
22
23  beforeEach(async () => {
24    await E2eTestUtils.beforeEach(1000);
25    await browser.get(E2eTestUtils.WINSCOPE_URL);
26  });
27
28  it('processes trace from zip and navigates correctly', async () => {
29    await loadTraces();
30    await E2eTestUtils.checkTimelineTraceSelector({
31      icon: 'layers',
32      color: 'rgba(78, 205, 230, 1)',
33    });
34    await E2eTestUtils.checkInitialRealTimestamp('2022-11-21, 18:05:09.780');
35    await E2eTestUtils.checkFinalRealTimestamp('2022-11-21, 18:05:18.607');
36
37    await E2eTestUtils.changeRealTimestampInWinscope(
38      '2022-11-21, 18:05:11.314',
39    );
40    await E2eTestUtils.checkWinscopeRealTimestamp('18:05:11.314');
41    await E2eTestUtils.filterHierarchy(
42      viewerSelector,
43      'ConversationListActivity#632',
44    );
45    await E2eTestUtils.selectItemInHierarchy(
46      viewerSelector,
47      'com.google.android.apps.messaging/com.google.android.apps.messaging.ui.ConversationListActivity#632',
48    );
49    await checkLayerProperties();
50  });
51
52  async function loadTraces() {
53    await E2eTestUtils.loadTraceAndCheckViewer(
54      'traces/deployment_full_trace_phone.zip',
55      'Surface Flinger',
56      viewerSelector,
57    );
58  }
59
60  async function checkLayerProperties() {
61    const curatedProperties = element(
62      by.css('surface-flinger-property-groups'),
63    );
64    const isPresent = await curatedProperties.isPresent();
65    expect(isPresent).toBeTruthy();
66
67    const finalBounds = curatedProperties.element(by.css('.final-bounds'));
68    const finalBoundsText = await finalBounds.getText();
69    expect(finalBoundsText).toEqual(
70      'Final Bounds: (162.418, 346.428) - (917.582, 1982.619)',
71    );
72
73    const transform = curatedProperties.element(
74      by.css('.geometry .left-column transform-matrix'),
75    );
76    const transformText = await transform.getText();
77    expect(transformText).toEqual(
78      '0.699\n0\n162.418\n0\n0.699\n346.428\n0\n0\n1',
79    );
80
81    const flags = curatedProperties.element(by.css('.flags'));
82    const flagsText = await flags.getText();
83    expect(flagsText).toEqual('Flags: OPAQUE | ENABLE_BACKPRESSURE (0x102)');
84
85    const destinationFrame = curatedProperties.element(by.css('.dest-frame'));
86    const destinationFrameText = await destinationFrame.getText();
87    expect(destinationFrameText).toEqual(
88      'Destination Frame: (0, 0) - (1080, 2340)',
89    );
90  }
91});
92