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

Unified Diff: sync/internal_api/http_bridge_unittest.cc

Issue 23717047: Retry: sync: Gracefully handle early shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renames 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
« no previous file with comments | « sync/internal_api/http_bridge.cc ('k') | sync/internal_api/internal_components_factory_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/http_bridge_unittest.cc
diff --git a/sync/internal_api/http_bridge_unittest.cc b/sync/internal_api/http_bridge_unittest.cc
index 9cb37df56532bf0188bed543c2355bd12a1ce947..e1dc6decb9d22fc173d23c3353a41284b7154e37 100644
--- a/sync/internal_api/http_bridge_unittest.cc
+++ b/sync/internal_api/http_bridge_unittest.cc
@@ -9,6 +9,7 @@
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_test_util.h"
+#include "sync/internal_api/public/base/cancelation_signal.h"
#include "sync/internal_api/public/http_bridge.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -407,14 +408,16 @@ TEST_F(SyncHttpBridgeTest, AbortAndReleaseBeforeFetchComplete) {
void HttpBridgeRunOnSyncThread(
net::URLRequestContextGetter* baseline_context_getter,
+ CancelationSignal* factory_cancelation_signal,
syncer::HttpPostProviderFactory** bridge_factory_out,
syncer::HttpPostProviderInterface** bridge_out,
base::WaitableEvent* signal_when_created,
base::WaitableEvent* wait_for_shutdown) {
- scoped_ptr<syncer::HttpPostProviderFactory> bridge_factory(
+ scoped_ptr<syncer::HttpBridgeFactory> bridge_factory(
new syncer::HttpBridgeFactory(baseline_context_getter,
- "test",
- NetworkTimeUpdateCallback()));
+ NetworkTimeUpdateCallback(),
+ factory_cancelation_signal));
+ bridge_factory->Init("test");
*bridge_factory_out = bridge_factory.get();
HttpPostProviderInterface* bridge = bridge_factory->Create();
@@ -447,18 +450,21 @@ TEST_F(SyncHttpBridgeTest, RequestContextGetterReleaseOrder) {
base::WaitableEvent signal_when_created(false, false);
base::WaitableEvent wait_for_shutdown(false, false);
+ CancelationSignal release_request_context_signal;
+
// Create bridge factory and factory on sync thread and wait for the creation
// to finish.
sync_thread.message_loop()->PostTask(FROM_HERE,
base::Bind(&HttpBridgeRunOnSyncThread,
base::Unretained(baseline_context_getter.get()),
- &factory, &bridge, &signal_when_created, &wait_for_shutdown));
+ &release_request_context_signal ,&factory, &bridge,
+ &signal_when_created, &wait_for_shutdown));
signal_when_created.Wait();
// Simulate sync shutdown by aborting bridge and shutting down factory on
// frontend.
bridge->Abort();
- factory->Shutdown();
+ release_request_context_signal.Signal();
// Wait for sync's RequestContextGetter to be cleared on IO thread and
// check for reference count.
« no previous file with comments | « sync/internal_api/http_bridge.cc ('k') | sync/internal_api/internal_components_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698