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

Unified Diff: trunk/src/sync/internal_api/syncapi_server_connection_manager_unittest.cc

Issue 23658030: Revert 222154 "sync: Gracefully handle very early shutdown" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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: trunk/src/sync/internal_api/syncapi_server_connection_manager_unittest.cc
===================================================================
--- trunk/src/sync/internal_api/syncapi_server_connection_manager_unittest.cc (revision 222204)
+++ trunk/src/sync/internal_api/syncapi_server_connection_manager_unittest.cc (working copy)
@@ -12,7 +12,6 @@
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "net/base/net_errors.h"
-#include "sync/internal_api/public/base/cancelation_signal.h"
#include "sync/internal_api/public/http_post_provider_factory.h"
#include "sync/internal_api/public/http_post_provider_interface.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -68,34 +67,14 @@
} // namespace
-// Ask the ServerConnectionManager to stop before it is created.
-TEST(SyncAPIServerConnectionManagerTest, VeryEarlyAbortPost) {
- CancelationSignal signal;
- signal.RequestStop();
- SyncAPIServerConnectionManager server(
- "server", 0, true, false, new BlockingHttpPostFactory(), &signal);
-
- ServerConnectionManager::PostBufferParams params;
- ScopedServerStatusWatcher watcher(&server, &params.response);
-
- bool result = server.PostBufferToPath(
- &params, "/testpath", "testauth", &watcher);
-
- EXPECT_FALSE(result);
- EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE,
- params.response.server_status);
-}
-
-// Ask the ServerConnectionManager to stop before its first request is made.
TEST(SyncAPIServerConnectionManagerTest, EarlyAbortPost) {
- CancelationSignal signal;
SyncAPIServerConnectionManager server(
- "server", 0, true, false, new BlockingHttpPostFactory(), &signal);
+ "server", 0, true, false, new BlockingHttpPostFactory());
ServerConnectionManager::PostBufferParams params;
ScopedServerStatusWatcher watcher(&server, &params.response);
- signal.RequestStop();
+ server.TerminateAllIO();
bool result = server.PostBufferToPath(
&params, "/testpath", "testauth", &watcher);
@@ -104,11 +83,9 @@
params.response.server_status);
}
-// Ask the ServerConnectionManager to stop during a request.
TEST(SyncAPIServerConnectionManagerTest, AbortPost) {
- CancelationSignal signal;
SyncAPIServerConnectionManager server(
- "server", 0, true, false, new BlockingHttpPostFactory(), &signal);
+ "server", 0, true, false, new BlockingHttpPostFactory());
ServerConnectionManager::PostBufferParams params;
ScopedServerStatusWatcher watcher(&server, &params.response);
@@ -117,8 +94,8 @@
ASSERT_TRUE(abort_thread.Start());
abort_thread.message_loop()->PostDelayedTask(
FROM_HERE,
- base::Bind(&CancelationSignal::RequestStop,
- base::Unretained(&signal)),
+ base::Bind(&ServerConnectionManager::TerminateAllIO,
+ base::Unretained(&server)),
TestTimeouts::tiny_timeout());
bool result = server.PostBufferToPath(

Powered by Google App Engine
This is Rietveld 408576698