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

Side by Side Diff: sync/internal_api/syncapi_server_connection_manager_unittest.cc

Issue 629733002: replace OVERRIDE and FINAL with override and final in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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/time.h" 13 #include "base/time/time.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "sync/internal_api/public/base/cancelation_signal.h" 15 #include "sync/internal_api/public/base/cancelation_signal.h"
16 #include "sync/internal_api/public/http_post_provider_factory.h" 16 #include "sync/internal_api/public/http_post_provider_factory.h"
17 #include "sync/internal_api/public/http_post_provider_interface.h" 17 #include "sync/internal_api/public/http_post_provider_interface.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace syncer { 20 namespace syncer {
21 namespace { 21 namespace {
22 22
23 using base::TimeDelta; 23 using base::TimeDelta;
24 24
25 class BlockingHttpPost : public HttpPostProviderInterface { 25 class BlockingHttpPost : public HttpPostProviderInterface {
26 public: 26 public:
27 BlockingHttpPost() : wait_for_abort_(false, false) {} 27 BlockingHttpPost() : wait_for_abort_(false, false) {}
28 virtual ~BlockingHttpPost() {} 28 virtual ~BlockingHttpPost() {}
29 29
30 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} 30 virtual void SetExtraRequestHeaders(const char* headers) override {}
31 virtual void SetURL(const char* url, int port) OVERRIDE {} 31 virtual void SetURL(const char* url, int port) override {}
32 virtual void SetPostPayload(const char* content_type, 32 virtual void SetPostPayload(const char* content_type,
33 int content_length, 33 int content_length,
34 const char* content) OVERRIDE {} 34 const char* content) override {}
35 virtual bool MakeSynchronousPost(int* error_code, int* response_code) 35 virtual bool MakeSynchronousPost(int* error_code, int* response_code)
36 OVERRIDE { 36 override {
37 wait_for_abort_.TimedWait(TestTimeouts::action_max_timeout()); 37 wait_for_abort_.TimedWait(TestTimeouts::action_max_timeout());
38 *error_code = net::ERR_ABORTED; 38 *error_code = net::ERR_ABORTED;
39 return false; 39 return false;
40 } 40 }
41 virtual int GetResponseContentLength() const OVERRIDE { 41 virtual int GetResponseContentLength() const override {
42 return 0; 42 return 0;
43 } 43 }
44 virtual const char* GetResponseContent() const OVERRIDE { 44 virtual const char* GetResponseContent() const override {
45 return ""; 45 return "";
46 } 46 }
47 virtual const std::string GetResponseHeaderValue( 47 virtual const std::string GetResponseHeaderValue(
48 const std::string& name) const OVERRIDE { 48 const std::string& name) const override {
49 return std::string(); 49 return std::string();
50 } 50 }
51 virtual void Abort() OVERRIDE { 51 virtual void Abort() override {
52 wait_for_abort_.Signal(); 52 wait_for_abort_.Signal();
53 } 53 }
54 private: 54 private:
55 base::WaitableEvent wait_for_abort_; 55 base::WaitableEvent wait_for_abort_;
56 }; 56 };
57 57
58 class BlockingHttpPostFactory : public HttpPostProviderFactory { 58 class BlockingHttpPostFactory : public HttpPostProviderFactory {
59 public: 59 public:
60 virtual ~BlockingHttpPostFactory() {} 60 virtual ~BlockingHttpPostFactory() {}
61 virtual void Init(const std::string& user_agent) OVERRIDE {} 61 virtual void Init(const std::string& user_agent) override {}
62 virtual HttpPostProviderInterface* Create() OVERRIDE { 62 virtual HttpPostProviderInterface* Create() override {
63 return new BlockingHttpPost(); 63 return new BlockingHttpPost();
64 } 64 }
65 virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE { 65 virtual void Destroy(HttpPostProviderInterface* http) override {
66 delete static_cast<BlockingHttpPost*>(http); 66 delete static_cast<BlockingHttpPost*>(http);
67 } 67 }
68 }; 68 };
69 69
70 } // namespace 70 } // namespace
71 71
72 // Ask the ServerConnectionManager to stop before it is created. 72 // Ask the ServerConnectionManager to stop before it is created.
73 TEST(SyncAPIServerConnectionManagerTest, VeryEarlyAbortPost) { 73 TEST(SyncAPIServerConnectionManagerTest, VeryEarlyAbortPost) {
74 CancelationSignal signal; 74 CancelationSignal signal;
75 signal.Signal(); 75 signal.Signal();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 bool result = server.PostBufferToPath( 125 bool result = server.PostBufferToPath(
126 &params, "/testpath", "testauth", &watcher); 126 &params, "/testpath", "testauth", &watcher);
127 127
128 EXPECT_FALSE(result); 128 EXPECT_FALSE(result);
129 EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE, 129 EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE,
130 params.response.server_status); 130 params.response.server_status);
131 abort_thread.Stop(); 131 abort_thread.Stop();
132 } 132 }
133 133
134 } // namespace syncer 134 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/syncapi_server_connection_manager.h ('k') | sync/internal_api/test/sync_manager_for_profile_sync_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698