Loading adb/bugreport.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface show_progress_(show_progress), status_(0), line_() { SetLineMessage(); SetLineMessage("generating"); } void OnStdout(const char* buffer, int length) { Loading Loading @@ -97,6 +97,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface OS_PATH_SEPARATOR, dest_file_.c_str()); } std::vector<const char*> srcs{src_file_.c_str()}; SetLineMessage("pulling"); status_ = br_->DoSyncPull(srcs, destination.c_str(), true, line_message_.c_str()) ? 0 : 1; if (status_ != 0) { Loading @@ -111,9 +112,8 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface } private: void SetLineMessage() { line_message_ = android::base::StringPrintf("generating %s", adb_basename(dest_file_).c_str()); void SetLineMessage(const std::string& action) { line_message_ = action + " " + adb_basename(dest_file_); } void SetSrcFile(const std::string path) { Loading @@ -121,7 +121,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface if (!dest_dir_.empty()) { // Only uses device-provided name when user passed a directory. dest_file_ = adb_basename(path); SetLineMessage(); SetLineMessage("generating"); } } Loading adb/bugreport_test.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ TEST_F(BugreportTest, NoArgumentsNDevice) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport"}; Loading @@ -209,7 +209,7 @@ TEST_F(BugreportTest, NoArgumentsPostNDevice) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip\n")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport"}; Loading @@ -223,7 +223,7 @@ TEST_F(BugreportTest, OkNDevice) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; Loading @@ -239,7 +239,7 @@ TEST_F(BugreportTest, OkNDeviceSplitBuffer) { WithArg<4>(WriteOnStdout("/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; Loading Loading @@ -275,7 +275,7 @@ TEST_F(BugreportTest, OkProgress) { WithArg<4>(ReturnCallbackDone()))); // clang-format on EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; Loading @@ -294,7 +294,7 @@ TEST_F(BugreportTest, OkDirectory) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", td.path}; Loading @@ -308,7 +308,7 @@ TEST_F(BugreportTest, OkNoExtension) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip\n")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file"}; Loading @@ -327,7 +327,7 @@ TEST_F(BugreportTest, OkNDeviceDirectory) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", td.path}; Loading Loading
adb/bugreport.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface show_progress_(show_progress), status_(0), line_() { SetLineMessage(); SetLineMessage("generating"); } void OnStdout(const char* buffer, int length) { Loading Loading @@ -97,6 +97,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface OS_PATH_SEPARATOR, dest_file_.c_str()); } std::vector<const char*> srcs{src_file_.c_str()}; SetLineMessage("pulling"); status_ = br_->DoSyncPull(srcs, destination.c_str(), true, line_message_.c_str()) ? 0 : 1; if (status_ != 0) { Loading @@ -111,9 +112,8 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface } private: void SetLineMessage() { line_message_ = android::base::StringPrintf("generating %s", adb_basename(dest_file_).c_str()); void SetLineMessage(const std::string& action) { line_message_ = action + " " + adb_basename(dest_file_); } void SetSrcFile(const std::string path) { Loading @@ -121,7 +121,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface if (!dest_dir_.empty()) { // Only uses device-provided name when user passed a directory. dest_file_ = adb_basename(path); SetLineMessage(); SetLineMessage("generating"); } } Loading
adb/bugreport_test.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ TEST_F(BugreportTest, NoArgumentsNDevice) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport"}; Loading @@ -209,7 +209,7 @@ TEST_F(BugreportTest, NoArgumentsPostNDevice) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip\n")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport"}; Loading @@ -223,7 +223,7 @@ TEST_F(BugreportTest, OkNDevice) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; Loading @@ -239,7 +239,7 @@ TEST_F(BugreportTest, OkNDeviceSplitBuffer) { WithArg<4>(WriteOnStdout("/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; Loading Loading @@ -275,7 +275,7 @@ TEST_F(BugreportTest, OkProgress) { WithArg<4>(ReturnCallbackDone()))); // clang-format on EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; Loading @@ -294,7 +294,7 @@ TEST_F(BugreportTest, OkDirectory) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", td.path}; Loading @@ -308,7 +308,7 @@ TEST_F(BugreportTest, OkNoExtension) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip\n")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), true, StrEq("generating file.zip"))) true, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file"}; Loading @@ -327,7 +327,7 @@ TEST_F(BugreportTest, OkNDeviceDirectory) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), true, StrEq("generating da_bugreport.zip"))) true, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", td.path}; Loading