system/corennnnn
修訂 | 8206c1caf4be216403c8d23998e3a38d5c43ac92 (tree) |
---|---|
時間 | 2016-08-16 08:04:16 |
作者 | Felipe Leme <felipeal@goog...> |
Commiter | Felipe Leme |
Split 'generating' and 'pulling' in 2 messages.
*** Cherrypicked from 9c0be90528baee54182334048af467e3dde74d72 ***
Change-Id: I00067fe160ca9e5351a8767b159d5f1d698083b4
Fixes: 30799929
@@ -47,7 +47,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface | ||
47 | 47 | show_progress_(show_progress), |
48 | 48 | status_(0), |
49 | 49 | line_() { |
50 | - SetLineMessage(); | |
50 | + SetLineMessage("generating"); | |
51 | 51 | } |
52 | 52 | |
53 | 53 | void OnStdout(const char* buffer, int length) { |
@@ -97,6 +97,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface | ||
97 | 97 | OS_PATH_SEPARATOR, dest_file_.c_str()); |
98 | 98 | } |
99 | 99 | std::vector<const char*> srcs{src_file_.c_str()}; |
100 | + SetLineMessage("pulling"); | |
100 | 101 | status_ = |
101 | 102 | br_->DoSyncPull(srcs, destination.c_str(), true, line_message_.c_str()) ? 0 : 1; |
102 | 103 | if (status_ != 0) { |
@@ -111,9 +112,8 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface | ||
111 | 112 | } |
112 | 113 | |
113 | 114 | private: |
114 | - void SetLineMessage() { | |
115 | - line_message_ = | |
116 | - android::base::StringPrintf("generating %s", adb_basename(dest_file_).c_str()); | |
115 | + void SetLineMessage(const std::string& action) { | |
116 | + line_message_ = action + " " + adb_basename(dest_file_); | |
117 | 117 | } |
118 | 118 | |
119 | 119 | void SetSrcFile(const std::string path) { |
@@ -121,7 +121,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface | ||
121 | 121 | if (!dest_dir_.empty()) { |
122 | 122 | // Only uses device-provided name when user passed a directory. |
123 | 123 | dest_file_ = adb_basename(path); |
124 | - SetLineMessage(); | |
124 | + SetLineMessage("generating"); | |
125 | 125 | } |
126 | 126 | } |
127 | 127 |
@@ -189,7 +189,7 @@ TEST_F(BugreportTest, NoArgumentsNDevice) { | ||
189 | 189 | .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), |
190 | 190 | WithArg<4>(ReturnCallbackDone()))); |
191 | 191 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), |
192 | - true, StrEq("generating da_bugreport.zip"))) | |
192 | + true, StrEq("pulling da_bugreport.zip"))) | |
193 | 193 | .WillOnce(Return(true)); |
194 | 194 | |
195 | 195 | const char* args[] = {"bugreport"}; |
@@ -209,7 +209,7 @@ TEST_F(BugreportTest, NoArgumentsPostNDevice) { | ||
209 | 209 | WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip\n")), |
210 | 210 | WithArg<4>(ReturnCallbackDone()))); |
211 | 211 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), |
212 | - true, StrEq("generating da_bugreport.zip"))) | |
212 | + true, StrEq("pulling da_bugreport.zip"))) | |
213 | 213 | .WillOnce(Return(true)); |
214 | 214 | |
215 | 215 | const char* args[] = {"bugreport"}; |
@@ -223,7 +223,7 @@ TEST_F(BugreportTest, OkNDevice) { | ||
223 | 223 | .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip")), |
224 | 224 | WithArg<4>(ReturnCallbackDone()))); |
225 | 225 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), |
226 | - true, StrEq("generating file.zip"))) | |
226 | + true, StrEq("pulling file.zip"))) | |
227 | 227 | .WillOnce(Return(true)); |
228 | 228 | |
229 | 229 | const char* args[] = {"bugreport", "file.zip"}; |
@@ -239,7 +239,7 @@ TEST_F(BugreportTest, OkNDeviceSplitBuffer) { | ||
239 | 239 | WithArg<4>(WriteOnStdout("/bugreport.zip")), |
240 | 240 | WithArg<4>(ReturnCallbackDone()))); |
241 | 241 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), |
242 | - true, StrEq("generating file.zip"))) | |
242 | + true, StrEq("pulling file.zip"))) | |
243 | 243 | .WillOnce(Return(true)); |
244 | 244 | |
245 | 245 | const char* args[] = {"bugreport", "file.zip"}; |
@@ -275,7 +275,7 @@ TEST_F(BugreportTest, OkProgress) { | ||
275 | 275 | WithArg<4>(ReturnCallbackDone()))); |
276 | 276 | // clang-format on |
277 | 277 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), |
278 | - true, StrEq("generating file.zip"))) | |
278 | + true, StrEq("pulling file.zip"))) | |
279 | 279 | .WillOnce(Return(true)); |
280 | 280 | |
281 | 281 | const char* args[] = {"bugreport", "file.zip"}; |
@@ -294,7 +294,7 @@ TEST_F(BugreportTest, OkDirectory) { | ||
294 | 294 | WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), |
295 | 295 | WithArg<4>(ReturnCallbackDone()))); |
296 | 296 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), |
297 | - true, StrEq("generating da_bugreport.zip"))) | |
297 | + true, StrEq("pulling da_bugreport.zip"))) | |
298 | 298 | .WillOnce(Return(true)); |
299 | 299 | |
300 | 300 | const char* args[] = {"bugreport", td.path}; |
@@ -308,7 +308,7 @@ TEST_F(BugreportTest, OkNoExtension) { | ||
308 | 308 | .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip\n")), |
309 | 309 | WithArg<4>(ReturnCallbackDone()))); |
310 | 310 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), |
311 | - true, StrEq("generating file.zip"))) | |
311 | + true, StrEq("pulling file.zip"))) | |
312 | 312 | .WillOnce(Return(true)); |
313 | 313 | |
314 | 314 | const char* args[] = {"bugreport", "file"}; |
@@ -327,7 +327,7 @@ TEST_F(BugreportTest, OkNDeviceDirectory) { | ||
327 | 327 | WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), |
328 | 328 | WithArg<4>(ReturnCallbackDone()))); |
329 | 329 | EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), |
330 | - true, StrEq("generating da_bugreport.zip"))) | |
330 | + true, StrEq("pulling da_bugreport.zip"))) | |
331 | 331 | .WillOnce(Return(true)); |
332 | 332 | |
333 | 333 | const char* args[] = {"bugreport", td.path}; |