| // Copyright 2014 The Flutter Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| /// JSON template for the contents of the auth_opt.json file created by goldctl. |
| String authTemplate({ |
| bool gsutil = false, |
| }) { |
| return ''' |
| { |
| "Luci":false, |
| "ServiceAccount":"${gsutil ? '' : '/packages/flutter/test/widgets/serviceAccount.json'}", |
| "GSUtil":$gsutil |
| } |
| '''; |
| } |
| |
| /// JSON response template for Skia Gold expectations request: |
| /// https://flutter-gold.skia.org/json/expectations/commit/HEAD |
| String rawExpectationsTemplate() { |
| return ''' |
| { |
| "md5": "a7489b00e03a1846e43500b7c14dd7b0", |
| "master": { |
| "flutter.golden_test.1": { |
| "55109a4bed52acc780530f7a9aeff6c0": 1 |
| }, |
| "flutter.golden_test.3": { |
| "87cb35131e6ad4b57d4d09d59ae743c3": 1, |
| "dc94eb2c39c0c8ae11a4efd090b72f94": 1, |
| "f2583c9003978a06b7888878bdc089e2": 1 |
| }, |
| "flutter.golden_test.2": { |
| "eb03a5e3114c9ecad5e4f1178f285a49": 1, |
| "f14631979de24fca6e14ad247d5f2bd6": 1 |
| } |
| } |
| } |
| '''; |
| } |
| |
| /// Decoded json response template for Skia Gold expectations request: |
| /// https://flutter-gold.skia.org/json/expectations/commit/HEAD |
| Map<String, List<String>> expectationsTemplate() { |
| return <String, List<String>>{ |
| 'flutter.golden_test.1': <String>[ |
| '55109a4bed52acc780530f7a9aeff6c0' |
| ], |
| 'flutter.golden_test.3': <String>[ |
| '87cb35131e6ad4b57d4d09d59ae743c3', |
| 'dc94eb2c39c0c8ae11a4efd090b72f94', |
| 'f2583c9003978a06b7888878bdc089e2', |
| ], |
| 'flutter.golden_test.2': <String>[ |
| 'eb03a5e3114c9ecad5e4f1178f285a49', |
| 'f14631979de24fca6e14ad247d5f2bd6', |
| ], |
| }; |
| } |
| |
| /// Same as [rawExpectationsTemplate] but with the temporary key. |
| String rawExpectationsTemplateWithTemporaryKey() { |
| return ''' |
| { |
| "md5": "a7489b00e03a1846e43500b7c14dd7b0", |
| "master_str": { |
| "flutter.golden_test.1": { |
| "55109a4bed52acc780530f7a9aeff6c0": 1 |
| }, |
| "flutter.golden_test.3": { |
| "87cb35131e6ad4b57d4d09d59ae743c3": 1, |
| "dc94eb2c39c0c8ae11a4efd090b72f94": 1, |
| "f2583c9003978a06b7888878bdc089e2": 1 |
| }, |
| "flutter.golden_test.2": { |
| "eb03a5e3114c9ecad5e4f1178f285a49": 1, |
| "f14631979de24fca6e14ad247d5f2bd6": 1 |
| } |
| } |
| } |
| '''; |
| } |
| |
| /// Json response template for Skia Gold digest request: |
| /// https://flutter-gold.skia.org/json/details?test=[testName]&digest=[expectation] |
| String digestResponseTemplate({ |
| String testName = 'flutter.golden_test.1', |
| String expectation = '55109a4bed52acc780530f7a9aeff6c0', |
| String platform = 'macos', |
| String status = 'positive', |
| }) { |
| return ''' |
| { |
| "digest": { |
| "test": "$testName", |
| "digest": "$expectation", |
| "status": "$status", |
| "paramset": { |
| "Platform": [ |
| "$platform" |
| ], |
| "ext": [ |
| "png" |
| ], |
| "name": [ |
| "$testName" |
| ], |
| "source_type": [ |
| "flutter" |
| ] |
| }, |
| "traces": { |
| "tileSize": 200, |
| "traces": [ |
| { |
| "data": [ |
| { |
| "x": 0, |
| "y": 0, |
| "s": 0 |
| }, |
| { |
| "x": 1, |
| "y": 0, |
| "s": 0 |
| }, |
| { |
| "x": 199, |
| "y": 0, |
| "s": 0 |
| } |
| ], |
| "label": ",Platform=$platform,name=$testName,source_type=flutter,", |
| "params": { |
| "Platform": "$platform", |
| "ext": "png", |
| "name": "$testName", |
| "source_type": "flutter" |
| } |
| } |
| ], |
| "digests": [ |
| { |
| "digest": "$expectation", |
| "status": "$status" |
| } |
| ] |
| }, |
| "closestRef": "pos", |
| "refDiffs": { |
| "neg": null, |
| "pos": { |
| "numDiffPixels": 999, |
| "pixelDiffPercent": 0.4995, |
| "maxRGBADiffs": [ |
| 86, |
| 86, |
| 86, |
| 0 |
| ], |
| "dimDiffer": false, |
| "diffs": { |
| "combined": 0.381955, |
| "percent": 0.4995, |
| "pixel": 999 |
| }, |
| "digest": "aa748136c70cefdda646df5be0ae189d", |
| "status": "positive", |
| "paramset": { |
| "Platform": [ |
| "$platform" |
| ], |
| "ext": [ |
| "png" |
| ], |
| "name": [ |
| "$testName" |
| ], |
| "source_type": [ |
| "flutter" |
| ] |
| }, |
| "n": 197 |
| } |
| } |
| }, |
| "commits": [ |
| { |
| "commit_time": 1568069344, |
| "hash": "399bb04e2de41665320d3c888f40af6d8bc734a2", |
| "author": "Contributor A (contributorA@getMail.com)" |
| }, |
| { |
| "commit_time": 1568078053, |
| "hash": "0f365d3add253a65e5e5af1024f56c6169bf9739", |
| "author": "Contributor B (contributorB@getMail.com)" |
| }, |
| { |
| "commit_time": 1569353925, |
| "hash": "81e693a7fe3b808cc9ae2bb3a2cbe404e67ec773", |
| "author": "Contributor C (contributorC@getMail.com)" |
| } |
| ] |
| } |
| '''; |
| } |
| |
| /// Json response template for Skia Gold ignore request: |
| /// https://flutter-gold.skia.org/json/ignores |
| String ignoreResponseTemplate({ |
| String pullRequestNumber = '0000', |
| String testName = 'flutter.golden_test.1', |
| String otherTestName = 'flutter.golden_test.1', |
| String expires = '2019-09-06T21:28:18.815336Z', |
| String otherExpires = '2019-09-06T21:28:18.815336Z', |
| }) { |
| return ''' |
| [ |
| { |
| "id": "7579425228619212078", |
| "name": "contributor@getMail.com", |
| "updatedBy": "contributor@getMail.com", |
| "expires": "$expires", |
| "query": "ext=png&name=$testName", |
| "note": "https://github.com/flutter/flutter/pull/$pullRequestNumber" |
| }, |
| { |
| "id": "7579425228619212078", |
| "name": "contributor@getMail.com", |
| "updatedBy": "contributor@getMail.com", |
| "expires": "$otherExpires", |
| "query": "ext=png&name=$otherTestName", |
| "note": "https://github.com/flutter/flutter/pull/99999" |
| } |
| ] |
| '''; |
| } |
| |
| /// Json response template for Skia Gold image request: |
| /// https://flutter-gold.skia.org/img/images/[imageHash].png |
| List<List<int>> imageResponseTemplate() { |
| return <List<int>>[ |
| <int>[137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, |
| 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, 196, 137, 0], |
| <int>[0, 0, 11, 73, 68, 65, 84, 120, 1, 99, 97, 0, 2, 0, |
| 0, 25, 0, 5, 144, 240, 54, 245, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, |
| 130], |
| ]; |
| } |