summaryrefslogtreecommitdiffstats
path: root/adb/bugreport.h
diff options
context:
space:
mode:
authorFelipe Leme <felipeal@google.com>2016-07-19 17:07:22 -0700
committerJosh Gao <jmgao@google.com>2016-08-30 13:06:23 -0700
commit698e065e14840541f218a80241fa880703a7dbc5 (patch)
tree80608f70bb228676984d098e883e7112e066b66d /adb/bugreport.h
parent248722e7eb8d184677b2d858d3309d7ce055e532 (diff)
downloadcore-698e065e14840541f218a80241fa880703a7dbc5.tar.gz
core-698e065e14840541f218a80241fa880703a7dbc5.tar.bz2
core-698e065e14840541f218a80241fa880703a7dbc5.zip
DO NOT MERGE: Split bugreport() into its own file and added unit tests.
bugreport() will be soon refactored to track progress, which will require more comprehensive unit tests. As such, it's better to move it to its own files, which in turn also requires moving send_shell_command() and usage() to commandline.h. Fixes: 30100363 Bug: 30268737 Change-Id: I3cdf114a0b5547293320042ff0749a60886440b0 (cherry picked from commit 78e0963e4bce9cc9f0bbf0b686004ba15b1e3929) (cherry picked from commit 218e1ff75998052c7bb30b483c15e75a853283a8)
Diffstat (limited to 'adb/bugreport.h')
-rw-r--r--adb/bugreport.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/adb/bugreport.h b/adb/bugreport.h
new file mode 100644
index 000000000..ff3a45726
--- /dev/null
+++ b/adb/bugreport.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BUGREPORT_H
+#define BUGREPORT_H
+
+#include <vector>
+
+#include "adb.h"
+
+class Bugreport {
+ public:
+ Bugreport() {
+ }
+ int DoIt(TransportType transport_type, const char* serial, int argc, const char** argv);
+
+ protected:
+ // Functions below are abstractions of external functions so they can be
+ // mocked on tests.
+ virtual int SendShellCommand(TransportType transport_type, const char* serial,
+ const std::string& command, bool disable_shell_protocol,
+ std::string* output = nullptr, std::string* err = nullptr);
+
+ virtual bool DoSyncPull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
+ const char* name);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Bugreport);
+};
+
+#endif // BUGREPORT_H