Write mkdirs in more idiomatic C++ style.

~ Rewrote mkdirs to be in C++ style.
~ Replaced adb_dir{start,stop} with std::string params and (r)find.
+ Added test for mkdirs.

Also make base/test_utils.h public and support temporary directories
as well as files.

Change-Id: I6fcbdc5e0099f3359d3aac6b00c436f250ca1329
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index d54faec..b0bcc88 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -859,7 +859,7 @@
 
     // If there are any slashes in it, assume it's a relative path;
     // make it absolute.
-    if (adb_dirstart(hint) != nullptr) {
+    if (adb_dirstart(hint) != std::string::npos) {
         std::string cwd;
         if (!getcwd(&cwd)) {
             fprintf(stderr, "adb: getcwd failed: %s\n", strerror(errno));
@@ -1467,15 +1467,15 @@
     return send_shell_command(transport, serial, cmd);
 }
 
-static const char* get_basename(const char* filename)
+static const char* get_basename(const std::string& filename)
 {
-    const char* basename = adb_dirstop(filename);
-    if (basename) {
-        basename++;
-        return basename;
+    size_t base = adb_dirstop(filename);
+    if (base != std::string::npos) {
+        ++base;
     } else {
-        return filename;
+        base = 0;
     }
+    return filename.c_str() + base;
 }
 
 static int install_app(TransportType transport, const char* serial, int argc, const char** argv) {