| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "sync/internal_api/syncapi_server_connection_manager.h" | 5 #include "sync/internal_api/syncapi_server_connection_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 11 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "sync/internal_api/public/http_post_provider_factory.h" | 15 #include "sync/internal_api/public/http_post_provider_factory.h" |
| 16 #include "sync/internal_api/public/http_post_provider_interface.h" | 16 #include "sync/internal_api/public/http_post_provider_interface.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 using base::TimeDelta; | |
| 20 using syncer::HttpResponse; | |
| 21 using syncer::ServerConnectionManager; | |
| 22 using syncer::ScopedServerStatusWatcher; | |
| 23 | |
| 24 namespace syncer { | 19 namespace syncer { |
| 25 namespace { | 20 namespace { |
| 26 | 21 |
| 22 using base::TimeDelta; |
| 23 |
| 27 class BlockingHttpPost : public HttpPostProviderInterface { | 24 class BlockingHttpPost : public HttpPostProviderInterface { |
| 28 public: | 25 public: |
| 29 BlockingHttpPost() : wait_for_abort_(false, false) {} | 26 BlockingHttpPost() : wait_for_abort_(false, false) {} |
| 30 virtual ~BlockingHttpPost() {} | 27 virtual ~BlockingHttpPost() {} |
| 31 | 28 |
| 32 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} | 29 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} |
| 33 virtual void SetURL(const char* url, int port) OVERRIDE {} | 30 virtual void SetURL(const char* url, int port) OVERRIDE {} |
| 34 virtual void SetPostPayload(const char* content_type, | 31 virtual void SetPostPayload(const char* content_type, |
| 35 int content_length, | 32 int content_length, |
| 36 const char* content) OVERRIDE {} | 33 const char* content) OVERRIDE {} |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 bool result = server.PostBufferToPath( | 101 bool result = server.PostBufferToPath( |
| 105 ¶ms, "/testpath", "testauth", &watcher); | 102 ¶ms, "/testpath", "testauth", &watcher); |
| 106 | 103 |
| 107 EXPECT_FALSE(result); | 104 EXPECT_FALSE(result); |
| 108 EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE, | 105 EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE, |
| 109 params.response.server_status); | 106 params.response.server_status); |
| 110 abort_thread.Stop(); | 107 abort_thread.Stop(); |
| 111 } | 108 } |
| 112 | 109 |
| 113 } // namespace syncer | 110 } // namespace syncer |
| OLD | NEW |