Add --resourcePath flag to the test program.

Review URL: https://codereview.chromium.org/12521016

git-svn-id: http://skia.googlecode.com/svn/trunk@8252 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 5d4af4c..9a63217 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -99,12 +99,18 @@
     return path;
 }
 
-static const char* gTmpDir;
+static SkString gTmpDir;
 
-const char* Test::GetTmpDir() {
+const SkString& Test::GetTmpDir() {
     return gTmpDir;
 }
 
+static SkString gResourcePath;
+
+const SkString& Test::GetResourcePath() {
+    return gResourcePath;
+}
+
 int tool_main(int argc, char** argv);
 int tool_main(int argc, char** argv) {
 #if SK_ENABLE_INST_COUNT
@@ -127,24 +133,30 @@
         } else if (0 == strcmp(*argv, "--tmpDir")) {
             ++argv;
             if (argv < stop && **argv) {
-                gTmpDir = *argv;
+                make_canonical_dir_path(*argv, &gTmpDir);
             } else {
                 SkDebugf("no following argument to --tmpDir\n");
                 return -1;
             }
+        } else if ((0 == strcmp(*argv, "--resourcePath")) ||
+                   (0 == strcmp(*argv, "-i"))) {
+            argv++;
+            if (argv < stop && **argv) {
+                make_canonical_dir_path(*argv, &gResourcePath);
+            }
         }
     }
 
-    SkString tmpDirStorage;
-    gTmpDir = make_canonical_dir_path(gTmpDir, &tmpDirStorage);
-
     {
         SkString header("Skia UnitTests:");
         if (matchStr) {
             header.appendf(" --match %s", matchStr);
         }
-        if (gTmpDir) {
-            header.appendf(" --tmpDir %s", gTmpDir);
+        if (!gTmpDir.isEmpty()) {
+            header.appendf(" --tmpDir %s", gTmpDir.c_str());
+        }
+        if (!gResourcePath.isEmpty()) {
+            header.appendf(" --resourcePath %s", gResourcePath.c_str());
         }
 #ifdef SK_DEBUG
         header.append(" SK_DEBUG");