Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: ct/go/util/util.go

Issue 1392173005: [CT] Update worker scripts to use new benchmarks and delete old benchmarks (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ct/go/util/constants.go ('k') | ct/go/worker_scripts/capture_archives/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ct/go/util/util.go
diff --git a/ct/go/util/util.go b/ct/go/util/util.go
index f126532cd9f9cfc8c4265e20e72c90c18c0dddc7..6030b4de27f23fc843c9ad47bfa7133c51fdfb10 100644
--- a/ct/go/util/util.go
+++ b/ct/go/util/util.go
@@ -3,6 +3,7 @@ package util
import (
"bufio"
+ "encoding/json"
"fmt"
"io"
"io/ioutil"
@@ -237,3 +238,25 @@ func ChromeProcessesCleaner(locker sync.Locker, chromeCleanerTimer time.Duration
locker.Unlock()
}
}
+
+// Contains the data included in CT pagesets.
+type PagesetVars struct {
+ // A comma separated list of URLs.
+ UrlsList string `json:"urls_list"`
+ // Will be either "mobile" or "desktop".
+ UserAgent string `json:"user_agent"`
+ // The location of the web page's WPR data file.
+ ArchiveDataFile string `json:"archive_data_file"`
+}
+
+func ReadPageset(pagesetPath string) (PagesetVars, error) {
+ decodedPageset := PagesetVars{}
+ pagesetContent, err := os.Open(pagesetPath)
+ if err != nil {
+ return decodedPageset, fmt.Errorf("Could not read %s: %s", pagesetPath, err)
+ }
+ if err := json.NewDecoder(pagesetContent).Decode(&decodedPageset); err != nil {
+ return decodedPageset, fmt.Errorf("Could not JSON decode %s: %s", pagesetPath, err)
+ }
+ return decodedPageset, nil
+}
« no previous file with comments | « ct/go/util/constants.go ('k') | ct/go/worker_scripts/capture_archives/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698