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

Unified Diff: chrome/browser/sync/test/integration/sync_errors_test.cc

Issue 7919001: test cases for server directed error handling code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 9 years, 3 months 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
Index: chrome/browser/sync/test/integration/sync_errors_test.cc
diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc
index 95c28cfe5d73b492b00ce2c6c8acc8d424f9f4ed..ef6a724c54b24fc4c6633affb181c4ba0d4515e6 100644
--- a/chrome/browser/sync/test/integration/sync_errors_test.cc
+++ b/chrome/browser/sync/test/integration/sync_errors_test.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
+#include "chrome/browser/sync/protocol/sync_protocol_error.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
@@ -46,3 +48,58 @@ IN_PROC_BROWSER_TEST_F(SyncErrorTest, TransientErrorTest) {
ASSERT_TRUE(
GetClient(0)->AwaitExponentialBackoffVerification());
}
+
+IN_PROC_BROWSER_TEST_F(SyncErrorTest, ActionableErrorTest) {
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+
+ const BookmarkNode* node1 = AddFolder(0, 0, L"title1");
+ SetTitle(0, node1, L"new_title1");
+ ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Sync."));
+
+ browser_sync::SyncProtocolError protocol_error;
+ protocol_error.error_type = browser_sync::TRANSIENT_ERROR;
+ protocol_error.action = browser_sync::UPGRADE_CLIENT;
+ protocol_error.error_description = "Not My Fault";
+ protocol_error.url = "www.google.com";
+ TriggerSyncError(protocol_error);
+
+ // Now make one more change so we will do another sync.
+ const BookmarkNode* node2 = AddFolder(0, 0, L"title2");
+ SetTitle(0, node2, L"new_title2");
+ ASSERT_TRUE(
+ GetClient(0)->AwaitActionableError());
+ ProfileSyncService::Status status = GetClient(0)->GetStatus();
+ ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type);
+ ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action);
+ ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url);
+ ASSERT_EQ(status.sync_protocol_error.error_description,
+ protocol_error.error_description);
+}
+
+IN_PROC_BROWSER_TEST_F(SyncErrorTest,
+ BirthdayErrorUsingActionableErrorTest) {
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+
+ const BookmarkNode* node1 = AddFolder(0, 0, L"title1");
+ SetTitle(0, node1, L"new_title1");
+ ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Sync."));
+
+ browser_sync::SyncProtocolError protocol_error;
+ protocol_error.error_type = browser_sync::NOT_MY_BIRTHDAY;
+ protocol_error.action = browser_sync::DISABLE_SYNC_ON_CLIENT;
+ protocol_error.error_description = "Not My Fault";
+ protocol_error.url = "www.google.com";
+ TriggerSyncError(protocol_error);
+
+ // Now make one more change so we will do another sync.
+ const BookmarkNode* node2 = AddFolder(0, 0, L"title2");
+ SetTitle(0, node2, L"new_title2");
+ ASSERT_TRUE(
+ GetClient(0)->AwaitSyncDisabled("Birthday Error."));
+ ProfileSyncService::Status status = GetClient(0)->GetStatus();
+ ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type);
+ ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action);
+ ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url);
+ ASSERT_EQ(status.sync_protocol_error.error_description,
+ protocol_error.error_description);
+}
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.cc ('k') | chrome/browser/sync/test/integration/sync_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698