OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" |
9 | 9 |
10 #include "SkCommonFlags.h" | 10 #include "SkCommonFlags.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 result["file_name"] = gFailures[i].fileName; | 68 result["file_name"] = gFailures[i].fileName; |
69 result["line_no"] = gFailures[i].lineNo; | 69 result["line_no"] = gFailures[i].lineNo; |
70 result["condition"] = gFailures[i].condition; | 70 result["condition"] = gFailures[i].condition; |
71 result["message"] = gFailures[i].message.c_str(); | 71 result["message"] = gFailures[i].message.c_str(); |
72 | 72 |
73 root["test_results"]["failures"].append(result); | 73 root["test_results"]["failures"].append(result); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json"); | 77 SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json"); |
| 78 sk_mkdir(FLAGS_writePath[0]); |
78 SkFILEWStream stream(path.c_str()); | 79 SkFILEWStream stream(path.c_str()); |
79 stream.writeText(Json::StyledWriter().write(root).c_str()); | 80 stream.writeText(Json::StyledWriter().write(root).c_str()); |
80 stream.flush(); | 81 stream.flush(); |
81 } | 82 } |
82 | 83 |
83 bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) { | 84 bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) { |
84 SkAutoTUnref<SkData> json(SkData::NewFromFileName(path)); | 85 SkAutoTUnref<SkData> json(SkData::NewFromFileName(path)); |
85 if (!json) { | 86 if (!json) { |
86 return false; | 87 return false; |
87 } | 88 } |
(...skipping 13 matching lines...) Expand all Loading... |
101 br.config = r["key"]["config"].asCString(); | 102 br.config = r["key"]["config"].asCString(); |
102 br.sourceType = r["key"]["source_type"].asCString(); | 103 br.sourceType = r["key"]["source_type"].asCString(); |
103 br.ext = r["ext"].asCString(); | 104 br.ext = r["ext"].asCString(); |
104 br.md5 = r["md5"].asCString(); | 105 br.md5 = r["md5"].asCString(); |
105 callback(br); | 106 callback(br); |
106 } | 107 } |
107 return true; | 108 return true; |
108 } | 109 } |
109 | 110 |
110 } // namespace DM | 111 } // namespace DM |
OLD | NEW |