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 /* This file is meant to be included by .cpp files, so it can spew out a | 8 /* This file is meant to be included by .cpp files, so it can spew out a |
| 9 customized class + global definition. | 9 customized class + global definition. |
| 10 | 10 |
| 11 e.g. | 11 e.g. |
| 12 #include "TestClassDef.h" | 12 #include "TestClassDef.h" |
| 13 | 13 |
| 14 DEF_TEST(some_test_name, r) { | 14 DEF_TEST(TestName, reporter) { |
| 15 ... | 15 ... |
| 16 REPORTER_ASSERT(r, x == 15); | 16 REPORTER_ASSERT(reporter, x == 15); |
| 17 } | 17 } |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #define DEF_TEST(name, reporter) \ | 20 #define DEF_TEST(name, reporter) \ |
| 21 static void name(skiatest::Reporter* reporter); \ | 21 static void name(skiatest::Reporter* reporter); \ |
| 22 namespace skiatest { \ | 22 namespace skiatest { \ |
| 23 class name##Class : public Test { \ | 23 class name##Class : public Test { \ |
| 24 public: \ | 24 public: \ |
| 25 static Test* Factory(void*) { return SkNEW(name##Class); } \ | 25 static Test* Factory(void*) { return SkNEW(name##Class); } \ |
| 26 protected: \ | 26 protected: \ |
| 27 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#name ); } \ | 27 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#name ); } \ |
| 28 virtual void onRun(Reporter* reporter) SK_OVERRIDE { name(reporter); } \ | 28 virtual void onRun(Reporter* reporter) SK_OVERRIDE { name(reporter); } \ |
| 29 }; \ | 29 }; \ |
| 30 static TestRegistry gReg_##name##Class(name##Class::Factory); \ | 30 static TestRegistry gReg_##name##Class(name##Class::Factory); \ |
| 31 } \ | 31 } \ |
| 32 static void name(skiatest::Reporter* reporter) | 32 static void name(skiatest::Reporter* reporter) |
| 33 | 33 |
| 34 #define DEFINE_GPUTESTCLASS(uiname, classname, function) \ | 34 #define DEF_GPUTEST(name, reporter, fatory) \ |
|
mtklein
2014/01/10 01:44:09
fatory -> factory?
tfarina
2014/01/10 01:55:27
poor tfarina, always forget to pay attention! :(
| |
| 35 namespace skiatest { \ | 35 static void name(skiatest::Reporter* reporter, GrContextFactory* factory); \ |
| 36 class classname : public GpuTest { \ | 36 namespace skiatest { \ |
| 37 public: \ | 37 class name##Class : public GpuTest { \ |
| 38 static Test* Factory(void*) { return SkNEW(classname); } \ | 38 public: \ |
| 39 protected: \ | 39 static Test* Factory(void*) { return SkNEW(name##Class); } \ |
| 40 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam e); } \ | 40 protected: \ |
| 41 virtual void onRun(Reporter* reporter) SK_OVERRIDE { \ | 41 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#name ); } \ |
| 42 function(reporter, GetGrContextFactory()); \ | 42 virtual void onRun(Reporter* reporter) SK_OVERRIDE { \ |
| 43 } \ | 43 name(reporter, GetGrContextFactory()); \ |
| 44 }; \ | 44 } \ |
| 45 static TestRegistry gReg_##classname(classname::Factory); \ | 45 }; \ |
| 46 } | 46 static TestRegistry gReg_##name##Class(name##Class::Factory); \ |
| 47 } \ | |
| 48 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) | |
| OLD | NEW |