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

Side by Side Diff: tests/Test.cpp

Issue 178273002: Let DM run unit tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « tests/Test.h ('k') | tests/skia_test.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkCommandLineFlags.h"
10 #include "SkError.h" 11 #include "SkError.h"
11 #include "SkString.h" 12 #include "SkString.h"
12 #include "SkTArray.h" 13 #include "SkTArray.h"
13 #include "SkTime.h" 14 #include "SkTime.h"
14 15
15 #if SK_SUPPORT_GPU 16 #if SK_SUPPORT_GPU
16 #include "GrContext.h" 17 #include "GrContext.h"
17 #include "gl/SkNativeGLContext.h" 18 #include "gl/SkNativeGLContext.h"
18 #else 19 #else
19 class GrContext; 20 class GrContext;
20 #endif 21 #endif
21 22
23 DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use.");
24
22 using namespace skiatest; 25 using namespace skiatest;
23 26
24 Reporter::Reporter() : fTestCount(0) { 27 Reporter::Reporter() : fTestCount(0) {
25 } 28 }
26 29
27 void Reporter::startTest(Test* test) { 30 void Reporter::startTest(Test* test) {
28 this->bumpTestCount(); 31 this->bumpTestCount();
29 this->onStart(test); 32 this->onStart(test);
30 } 33 }
31 34
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 fElapsed = SkTime::GetMSecs() - start; 110 fElapsed = SkTime::GetMSecs() - start;
108 111
109 // Now tell fReporter about any failures and wrap up. 112 // Now tell fReporter about any failures and wrap up.
110 for (int i = 0; i < local.numFailures(); i++) { 113 for (int i = 0; i < local.numFailures(); i++) {
111 fReporter->reportFailed(local.failure(i)); 114 fReporter->reportFailed(local.failure(i));
112 } 115 }
113 fReporter->endTest(this); 116 fReporter->endTest(this);
114 117
115 } 118 }
116 119
117 /////////////////////////////////////////////////////////////////////////////// 120 SkString Test::GetTmpDir() {
118 121 const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0];
119 #if SK_SUPPORT_GPU 122 return SkString(tmpDir);
120 #include "GrContextFactory.h"
121 GrContextFactory gGrContextFactory;
122 #endif
123
124 GrContextFactory* GpuTest::GetGrContextFactory() {
125 #if SK_SUPPORT_GPU
126 return &gGrContextFactory;
127 #else
128 return NULL;
129 #endif
130 } 123 }
131 124
132 void GpuTest::DestroyContexts() { 125 static const char* gResourcePath = NULL;
133 #if SK_SUPPORT_GPU 126 void Test::SetResourcePath(const char* resourcePath) { gResourcePath = resourceP ath; }
134 gGrContextFactory.destroyContexts(); 127
135 #endif 128 SkString Test::GetResourcePath() {
129 return SkString(gResourcePath);
136 } 130 }
131
OLDNEW
« no previous file with comments | « tests/Test.h ('k') | tests/skia_test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698