Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Unified Diff: sync/engine/download_unittest.cc

Issue 61213009: Don't drop debug_info when posting to sync server fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed erroneous use of SYNC_EXPORT_PRIVATE from MockDebugInfoGetter. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/download.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/download_unittest.cc
diff --git a/sync/engine/download_unittest.cc b/sync/engine/download_unittest.cc
index f38ab2b4c1397ea277ac0347555defdf9d00a82c..9336893eea758337e983e98b6a5f45d6a00161f8 100644
--- a/sync/engine/download_unittest.cc
+++ b/sync/engine/download_unittest.cc
@@ -14,10 +14,13 @@
#include "sync/sessions/status_controller.h"
#include "sync/syncable/directory.h"
#include "sync/test/engine/test_directory_setter_upper.h"
+#include "sync/test/sessions/mock_debug_info_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
+using sessions::MockDebugInfoGetter;
+
// A test fixture for tests exercising download updates functions.
class DownloadUpdatesTest : public ::testing::Test {
protected:
@@ -201,24 +204,6 @@ TEST_F(DownloadUpdatesTest, PollTest) {
EXPECT_TRUE(proto_request_types().Equals(progress_types));
}
-class MockDebugInfoGetter : public sessions::DebugInfoGetter {
- public:
- MockDebugInfoGetter() {}
- virtual ~MockDebugInfoGetter() {}
-
- virtual void GetAndClearDebugInfo(sync_pb::DebugInfo* debug_info) OVERRIDE {
- debug_info->CopyFrom(debug_info_);
- debug_info_.Clear();
- }
-
- void AddDebugEvent() {
- debug_info_.add_events();
- }
-
- private:
- sync_pb::DebugInfo debug_info_;
-};
-
class DownloadUpdatesDebugInfoTest : public ::testing::Test {
public:
DownloadUpdatesDebugInfoTest() {}
@@ -242,33 +227,20 @@ class DownloadUpdatesDebugInfoTest : public ::testing::Test {
};
-// Verify AppendDebugInfo when there are no events to upload.
-TEST_F(DownloadUpdatesDebugInfoTest, VerifyAppendDebugInfo_Empty) {
+// Verify CopyClientDebugInfo when there are no events to upload.
+TEST_F(DownloadUpdatesDebugInfoTest, VerifyCopyClientDebugInfo_Empty) {
sync_pb::DebugInfo debug_info;
- download::AppendClientDebugInfoIfNeeded(debug_info_getter(),
- status(),
- &debug_info);
+ download::CopyClientDebugInfo(debug_info_getter(), &debug_info);
EXPECT_EQ(0, debug_info.events_size());
}
-// We should upload debug info only once per sync cycle.
-TEST_F(DownloadUpdatesDebugInfoTest, TryDoubleAppend) {
- sync_pb::DebugInfo debug_info1;
-
- AddDebugEvent();
- download::AppendClientDebugInfoIfNeeded(debug_info_getter(),
- status(),
- &debug_info1);
- EXPECT_EQ(1, debug_info1.events_size());
-
-
- // Repeated invocations should not send up more events.
+TEST_F(DownloadUpdatesDebugInfoTest, VerifyCopyOverwrites) {
+ sync_pb::DebugInfo debug_info;
AddDebugEvent();
- sync_pb::DebugInfo debug_info2;
- download::AppendClientDebugInfoIfNeeded(debug_info_getter(),
- status(),
- &debug_info2);
- EXPECT_EQ(0, debug_info2.events_size());
+ download::CopyClientDebugInfo(debug_info_getter(), &debug_info);
+ EXPECT_EQ(1, debug_info.events_size());
+ download::CopyClientDebugInfo(debug_info_getter(), &debug_info);
+ EXPECT_EQ(1, debug_info.events_size());
}
} // namespace syncer
« no previous file with comments | « sync/engine/download.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698