Source code

Revision control

Other Tools

1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this
3
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5
from telemetry_harness.testcase import TelemetryTestCase
6
from telemetry_harness.ping_filters import MAIN_SHUTDOWN_PING
7
8
9
class TestMainTabScalars(TelemetryTestCase):
10
"""Tests for Telemetry Scalars."""
11
12
def test_main_tab_scalars(self):
13
"""Test for Telemetry Scalars."""
14
15
with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
16
start_tab = self.marionette.current_window_handle
17
18
tab2 = self.open_tab(focus=True)
19
self.marionette.switch_to_window(tab2)
20
21
tab3 = self.open_tab(focus=True)
22
self.marionette.switch_to_window(tab3)
23
24
self.marionette.close()
25
self.marionette.switch_to_window(tab2)
26
27
self.marionette.close()
28
self.marionette.switch_to_window(start_tab)
29
30
ping = self.wait_for_ping(self.restart_browser, MAIN_SHUTDOWN_PING)
31
32
self.assertEqual(ping["type"], "main")
33
self.assertEqual(ping["clientId"], self.client_id)
34
35
scalars = ping["payload"]["processes"]["parent"]["scalars"]
36
37
self.assertEqual(
38
scalars["browser.engagement.max_concurrent_tab_count"], 3
39
)
40
self.assertEqual(scalars["browser.engagement.tab_open_event_count"], 2)
41
self.assertEqual(
42
scalars["browser.engagement.max_concurrent_window_count"], 1
43
)