| Index: tests/skia_test.cpp | 
| diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp | 
| index 050a241ccd7ea9fec39b29afe0d67b8ed6cf3c72..48d87719d562c31c4cb7a3116f49d96fb41e4992 100644 | 
| --- a/tests/skia_test.cpp | 
| +++ b/tests/skia_test.cpp | 
| @@ -17,7 +17,6 @@ | 
|  | 
| #if SK_SUPPORT_GPU | 
| #include "GrContext.h" | 
| -#include "GrContextFactory.h" | 
| #endif | 
|  | 
| using namespace skiatest; | 
| @@ -30,6 +29,8 @@ | 
| "^ and $ requires an exact match\n" \ | 
| "If a test does not match any list entry,\n" \ | 
| "it is skipped unless some list entry starts with ~"); | 
| +DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use."); | 
| +DEFINE_string2(resourcePath, i, "resources", "directory for test resources."); | 
| DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); | 
| DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects."); | 
| DEFINE_bool2(single, z, false, "run tests on a single thread internally."); | 
| @@ -39,7 +40,6 @@ | 
| DEFINE_bool(gpu, true, "whether or not to run GPU tests."); | 
| DEFINE_int32(threads, SkThreadPool::kThreadPerCore, | 
| "Run threadsafe tests on a threadpool with this many threads."); | 
| -DEFINE_string2(resourcePath, i, "resources", "directory for test resources."); | 
|  | 
| // need to explicitly declare this, or we get some weird infinite loop llist | 
| template TestRegistry* TestRegistry::gHead; | 
| @@ -98,6 +98,16 @@ | 
| const int fTotal; | 
| }; | 
|  | 
| +SkString Test::GetTmpDir() { | 
| +    const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0]; | 
| +    return SkString(tmpDir); | 
| +} | 
| + | 
| +SkString Test::GetResourcePath() { | 
| +    const char* resourcePath = FLAGS_resourcePath.isEmpty() ? NULL : FLAGS_resourcePath[0]; | 
| +    return SkString(resourcePath); | 
| +} | 
| + | 
| // Deletes self when run. | 
| class SkTestRunnable : public SkRunnable { | 
| public: | 
| @@ -134,7 +144,6 @@ | 
| int tool_main(int argc, char** argv) { | 
| SkCommandLineFlags::SetUsage(""); | 
| SkCommandLineFlags::Parse(argc, argv); | 
| -    Test::SetResourcePath(FLAGS_resourcePath[0]); | 
|  | 
| #if SK_ENABLE_INST_COUNT | 
| if (FLAGS_leaks) { | 
| @@ -190,7 +199,7 @@ | 
| int skipCount = 0; | 
|  | 
| SkThreadPool threadpool(FLAGS_threads); | 
| -    SkTArray<Test*> gpuTests;  // Always passes ownership to an SkTestRunnable | 
| +    SkTArray<Test*> unsafeTests;  // Always passes ownership to an SkTestRunnable | 
|  | 
| DebugfReporter reporter(toRun); | 
| for (int i = 0; i < total; i++) { | 
| @@ -198,20 +207,16 @@ | 
| if (!should_run(test->getName(), test->isGPUTest())) { | 
| ++skipCount; | 
| } else if (test->isGPUTest()) { | 
| -            gpuTests.push_back() = test.detach(); | 
| +            unsafeTests.push_back() = test.detach(); | 
| } else { | 
| threadpool.add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCount))); | 
| } | 
| } | 
|  | 
| -#if SK_SUPPORT_GPU | 
| -    GrContextFactory grContextFactory; | 
| -    // Run GPU tests on this thread. | 
| -    for (int i = 0; i < gpuTests.count(); i++) { | 
| -        gpuTests[i]->setGrContextFactory(&grContextFactory); | 
| -        SkNEW_ARGS(SkTestRunnable, (gpuTests[i], &failCount))->run(); | 
| -    } | 
| -#endif | 
| +    // Run the tests that aren't threadsafe. | 
| +    for (int i = 0; i < unsafeTests.count(); i++) { | 
| +        SkNEW_ARGS(SkTestRunnable, (unsafeTests[i], &failCount))->run(); | 
| +    } | 
|  | 
| // Block until threaded tests finish. | 
| threadpool.wait(); | 
| @@ -221,6 +226,7 @@ | 
| toRun, failCount, skipCount, reporter.countTests()); | 
| } | 
| SkGraphics::Term(); | 
| +    GpuTest::DestroyContexts(); | 
|  | 
| SkDebugf("\n"); | 
| return (failCount == 0) ? 0 : 1; | 
|  |