Bug 1548694 - Split the profiler page information tests to prevent intermittent timeout r=julienw

Differential Revision: https://phabricator.services.mozilla.com/D29812

--HG--
rename : tools/profiler/tests/browser/browser_test_profile_history_page_info.js => tools/profiler/tests/browser/browser_test_profile_pushstate_page_info.js
rename : tools/profiler/tests/browser/browser_test_profile_page_info.js => tools/profiler/tests/browser/browser_test_profile_single_frame_page_info.js
extra : moz-landing-system : lando
This commit is contained in:
Nazım Can Altınova 2019-05-03 12:43:55 +00:00
Родитель 6e11f90460
Коммит 2ecffabef5
5 изменённых файлов: 88 добавлений и 80 удалений

Просмотреть файл

@ -6,5 +6,7 @@ support-files =
single_frame_pushstate.html
single_frame_replacestate.html
[browser_test_profile_page_info.js]
[browser_test_profile_history_page_info.js]
[browser_test_profile_single_frame_page_info.js]
[browser_test_profile_multi_frame_page_info.js]
[browser_test_profile_pushstate_page_info.js]
[browser_test_profile_replacestate_page_info.js]

Просмотреть файл

@ -0,0 +1,39 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test_profile_single_frame_page_info() {
if (!AppConstants.MOZ_GECKO_PROFILER) {
return;
}
Assert.ok(!Services.profiler.IsActive());
// Clear all pages in case we have some pages registered before.
await Services.profiler.ClearAllPages();
startProfiler();
const url = BASE_URL + "single_frame.html";
let contentPid;
await BrowserTestUtils.withNewTab(url, async function(contentBrowser) {
contentPid = await ContentTask.spawn(contentBrowser, null, () => {
return Services.appinfo.processID;
});
});
const profile = await Services.profiler.getProfileDataAsync();
Services.profiler.StopProfiler();
let pageFound = false;
// We need to find the correct content process for that tab.
let contentProcess = profile.processes.find(p => p.threads[0].pid == contentPid);
for (const page of contentProcess.pages) {
if (page.url == url) {
Assert.equal(page.url, url);
Assert.equal(typeof page.docshellId, "string");
Assert.equal(typeof page.historyId, "number");
Assert.equal(page.isSubFrame, false);
pageFound = true;
break;
}
}
Assert.equal(pageFound, true);
});

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test_profile_single_frame_pushstate_page_info() {
add_task(async function test_profile_pushstate_page_info() {
if (!AppConstants.MOZ_GECKO_PROFILER) {
return;
}
@ -47,44 +47,3 @@ add_task(async function test_profile_single_frame_pushstate_page_info() {
Assert.equal(foundPage, 2);
});
add_task(async function test_profile_single_frame_replacestate_page_info() {
if (!AppConstants.MOZ_GECKO_PROFILER) {
return;
}
Assert.ok(!Services.profiler.IsActive());
// Clear all pages in case we have some pages registered before.
await Services.profiler.ClearAllPages();
startProfiler();
const url = BASE_URL + "single_frame_replacestate.html";
let contentPid;
await BrowserTestUtils.withNewTab(url, async function(contentBrowser) {
contentPid = await ContentTask.spawn(contentBrowser, null, () => {
return Services.appinfo.processID;
});
});
const profile = await Services.profiler.getProfileDataAsync();
Services.profiler.StopProfiler();
let foundPage = 0;
// We need to find the correct content process for that tab.
let contentProcess = profile.processes.find(p => p.threads[0].pid == contentPid);
for (const page of contentProcess.pages) {
// Before replaceState
if (page.url == url) {
Assert.equal(page.url, url);
Assert.equal(typeof page.docshellId, "string");
Assert.equal(typeof page.historyId, "number");
Assert.equal(page.isSubFrame, false);
foundPage++;
}
// Shoudn't record the frame on replaceState since it's not changing
// DocShell ID or DocShell History ID.
Assert.notEqual(page.url, BASE_URL + "single_frame.html");
}
Assert.equal(foundPage, 1);
});

Просмотреть файл

@ -0,0 +1,44 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test_profile_replacestate_page_info() {
if (!AppConstants.MOZ_GECKO_PROFILER) {
return;
}
Assert.ok(!Services.profiler.IsActive());
// Clear all pages in case we have some pages registered before.
await Services.profiler.ClearAllPages();
startProfiler();
const url = BASE_URL + "single_frame_replacestate.html";
let contentPid;
await BrowserTestUtils.withNewTab(url, async function(contentBrowser) {
contentPid = await ContentTask.spawn(contentBrowser, null, () => {
return Services.appinfo.processID;
});
});
const profile = await Services.profiler.getProfileDataAsync();
Services.profiler.StopProfiler();
let foundPage = 0;
// We need to find the correct content process for that tab.
let contentProcess = profile.processes.find(p => p.threads[0].pid == contentPid);
for (const page of contentProcess.pages) {
// Before replaceState
if (page.url == url) {
Assert.equal(page.url, url);
Assert.equal(typeof page.docshellId, "string");
Assert.equal(typeof page.historyId, "number");
Assert.equal(page.isSubFrame, false);
foundPage++;
}
// Shoudn't record the frame on replaceState since it's not changing
// DocShell ID or DocShell History ID.
Assert.notEqual(page.url, BASE_URL + "single_frame.html");
}
Assert.equal(foundPage, 1);
});

Просмотреть файл

@ -2,42 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test_profile_single_frame_page_info() {
if (!AppConstants.MOZ_GECKO_PROFILER) {
return;
}
Assert.ok(!Services.profiler.IsActive());
// Clear all pages in case we have some pages registered before.
await Services.profiler.ClearAllPages();
startProfiler();
const url = BASE_URL + "single_frame.html";
let contentPid;
await BrowserTestUtils.withNewTab(url, async function(contentBrowser) {
contentPid = await ContentTask.spawn(contentBrowser, null, () => {
return Services.appinfo.processID;
});
});
const profile = await Services.profiler.getProfileDataAsync();
Services.profiler.StopProfiler();
let pageFound = false;
// We need to find the correct content process for that tab.
let contentProcess = profile.processes.find(p => p.threads[0].pid == contentPid);
for (const page of contentProcess.pages) {
if (page.url == url) {
Assert.equal(page.url, url);
Assert.equal(typeof page.docshellId, "string");
Assert.equal(typeof page.historyId, "number");
Assert.equal(page.isSubFrame, false);
pageFound = true;
break;
}
}
Assert.equal(pageFound, true);
});
add_task(async function test_profile_multi_frame_page_info() {
if (!AppConstants.MOZ_GECKO_PROFILER) {
return;