| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/message_loop_proxy.h" | 5 #include "base/message_loop_proxy.h" |
| 6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "net/test/test_server.h" | 8 #include "net/test/test_server.h" |
| 9 #include "net/url_request/test_url_fetcher_factory.h" | 9 #include "net/url_request/test_url_fetcher_factory.h" |
| 10 #include "net/url_request/url_fetcher_delegate.h" | 10 #include "net/url_request/url_fetcher_delegate.h" |
| 11 #include "net/url_request/url_request_test_util.h" | 11 #include "net/url_request/url_request_test_util.h" |
| 12 #include "sync/internal_api/public/http_bridge.h" | 12 #include "sync/internal_api/public/http_bridge.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace syncer { | 15 namespace syncer { |
| 16 | 16 |
| 17 namespace { | |
| 18 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. | |
| 19 const base::FilePath::CharType kDocRoot[] = | |
| 20 FILE_PATH_LITERAL("chrome/test/data"); | |
| 21 } | |
| 22 | |
| 23 class SyncHttpBridgeTest : public testing::Test { | 17 class SyncHttpBridgeTest : public testing::Test { |
| 24 public: | 18 public: |
| 25 SyncHttpBridgeTest() | 19 SyncHttpBridgeTest() |
| 26 : test_server_(net::TestServer::TYPE_HTTP, | 20 : test_server_(net::TestServer::TYPE_HTTP, |
| 27 net::TestServer::kLocalhost, | 21 net::TestServer::kLocalhost, |
| 28 base::FilePath(kDocRoot)), | 22 net::TestServer::GetTestDataPath()), |
| 29 fake_default_request_context_getter_(NULL), | 23 fake_default_request_context_getter_(NULL), |
| 30 bridge_for_race_test_(NULL), | 24 bridge_for_race_test_(NULL), |
| 31 io_thread_("IO thread") { | 25 io_thread_("IO thread") { |
| 32 } | 26 } |
| 33 | 27 |
| 34 virtual void SetUp() { | 28 virtual void SetUp() { |
| 35 base::Thread::Options options; | 29 base::Thread::Options options; |
| 36 options.message_loop_type = MessageLoop::TYPE_IO; | 30 options.message_loop_type = MessageLoop::TYPE_IO; |
| 37 io_thread_.StartWithOptions(options); | 31 io_thread_.StartWithOptions(options); |
| 38 } | 32 } |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // succeed even though we Release()d the bridge above because the call to | 392 // succeed even though we Release()d the bridge above because the call to |
| 399 // Abort should have held a reference. | 393 // Abort should have held a reference. |
| 400 io_waiter.Signal(); | 394 io_waiter.Signal(); |
| 401 | 395 |
| 402 // Done. | 396 // Done. |
| 403 sync_thread.Stop(); | 397 sync_thread.Stop(); |
| 404 io_thread()->Stop(); | 398 io_thread()->Stop(); |
| 405 } | 399 } |
| 406 | 400 |
| 407 } // namespace syncer | 401 } // namespace syncer |
| OLD | NEW |