Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(devtools): dynamically fetch chromium version #12232

Merged
merged 2 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions third-party/download-content-shell/download-content-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function main() {
fs.mkdirSync(CACHE_PATH, {recursive: true});
deleteOldContentShells();

findPreviousUploadedPosition(findMostRecentChromiumCommit())
findMostRecentChromiumCommit()
.then(findPreviousUploadedPosition)
.then(onUploadedCommitPosition)
.catch(onError);

Expand Down Expand Up @@ -64,13 +65,11 @@ function getPlatform() {
throw new Error(`Unrecognized platform detected: ${process.platform}`);
}

function findMostRecentChromiumCommit() {
// TODO: this code works only if there is a full chromium checkout present.
// const commitMessage = shell('git log --max-count=1 --grep="Cr-Commit-Position"').toString().trim();
// const commitPosition = commitMessage.match(/Cr-Commit-Position: refs\/heads\/master@\{#([0-9]+)\}/)[1];
// return commitPosition;
// TODO: make this dynamic.
return '856956';
async function findMostRecentChromiumCommit() {
const snapshotUrl = `https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/${PLATFORM}%2FLAST_CHANGE?alt=media`;
const commitPosition = await utils.fetch(snapshotUrl);

return commitPosition.toString();
}

function deleteOldContentShells() {
Expand Down
2 changes: 1 addition & 1 deletion third-party/download-content-shell/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function fetch(url) {

function getCallback(resolve, reject, response) {
if (response.statusCode !== 200) {
reject(new Error(`Request error: + ${response.statusCode}`));
reject(new Error(`Request error: ${response.statusCode}`));
return;
}
const body = new Stream();
Expand Down