Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
| 9 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
| 10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 } | 105 } |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 int32_t fNextIndex; | 108 int32_t fNextIndex; |
| 109 int32_t fPending; | 109 int32_t fPending; |
| 110 int fTotal; | 110 int fTotal; |
| 111 bool fAllowExtendedTest; | 111 bool fAllowExtendedTest; |
| 112 bool fAllowThreaded; | 112 bool fAllowThreaded; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 static const char* make_canonical_dir_path(const char* path, SkString* storage) { | |
| 116 if (path) { | |
| 117 // clean it up so it always has a trailing searator | |
| 118 size_t len = strlen(path); | |
| 119 if (0 == len) { | |
| 120 path = NULL; | |
| 121 } else if (SkPATH_SEPARATOR != path[len - 1]) { | |
| 122 // resize to len + 1, to make room for searator | |
| 123 storage->set(path, len + 1); | |
| 124 storage->writable_str()[len] = SkPATH_SEPARATOR; | |
| 125 path = storage->c_str(); | |
| 126 } | |
| 127 } | |
| 128 return path; | |
| 129 } | |
| 130 | |
| 131 static SkString gTmpDir; | 115 static SkString gTmpDir; |
|
epoger
2013/06/04 15:15:34
Hey, if this change fixes an existing problem, I'm
scroggo
2013/06/04 19:50:39
Done.
epoger
2013/06/05 14:34:14
My reasoning was: why use 2 global variables (gTmp
| |
| 132 | 116 |
| 133 const SkString& Test::GetTmpDir() { | 117 const SkString& Test::GetTmpDir() { |
| 134 return gTmpDir; | 118 return gTmpDir; |
| 135 } | 119 } |
| 136 | 120 |
| 137 static SkString gResourcePath; | 121 static SkString gResourcePath; |
| 138 | 122 |
| 139 const SkString& Test::GetResourcePath() { | 123 const SkString& Test::GetResourcePath() { |
| 140 return gResourcePath; | 124 return gResourcePath; |
| 141 } | 125 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 } | 196 } |
| 213 return !anyExclude; | 197 return !anyExclude; |
| 214 } | 198 } |
| 215 | 199 |
| 216 int tool_main(int argc, char** argv); | 200 int tool_main(int argc, char** argv); |
| 217 int tool_main(int argc, char** argv) { | 201 int tool_main(int argc, char** argv) { |
| 218 SkCommandLineFlags::SetUsage(""); | 202 SkCommandLineFlags::SetUsage(""); |
| 219 SkCommandLineFlags::Parse(argc, argv); | 203 SkCommandLineFlags::Parse(argc, argv); |
| 220 | 204 |
| 221 if (!FLAGS_tmpDir.isEmpty()) { | 205 if (!FLAGS_tmpDir.isEmpty()) { |
| 222 make_canonical_dir_path(FLAGS_tmpDir[0], &gTmpDir); | 206 gTmpDir = SkOSPath::SkPathJoin(FLAGS_tmpDir[0], NULL); |
| 223 } | 207 } |
| 224 if (!FLAGS_resourcePath.isEmpty()) { | 208 if (!FLAGS_resourcePath.isEmpty()) { |
| 225 make_canonical_dir_path(FLAGS_resourcePath[0], &gResourcePath); | 209 gResourcePath = SkOSPath::SkPathJoin(FLAGS_resourcePath[0], NULL); |
| 226 } | 210 } |
| 227 | 211 |
| 228 #if SK_ENABLE_INST_COUNT | 212 #if SK_ENABLE_INST_COUNT |
| 229 gPrintInstCount = true; | 213 gPrintInstCount = true; |
| 230 #endif | 214 #endif |
| 231 | 215 |
| 232 SkGraphics::Init(); | 216 SkGraphics::Init(); |
| 233 | 217 |
| 234 { | 218 { |
| 235 SkString header("Skia UnitTests:"); | 219 SkString header("Skia UnitTests:"); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 GpuTest::DestroyContexts(); | 304 GpuTest::DestroyContexts(); |
| 321 | 305 |
| 322 return (failCount == 0) ? 0 : 1; | 306 return (failCount == 0) ? 0 : 1; |
| 323 } | 307 } |
| 324 | 308 |
| 325 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 309 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 326 int main(int argc, char * const argv[]) { | 310 int main(int argc, char * const argv[]) { |
| 327 return tool_main(argc, (char**) argv); | 311 return tool_main(argc, (char**) argv); |
| 328 } | 312 } |
| 329 #endif | 313 #endif |
| OLD | NEW |