OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/sync/notifier/chrome_invalidation_client.h" | 8 #include "chrome/browser/sync/notifier/chrome_invalidation_client.h" |
9 #include "chrome/browser/sync/notifier/state_writer.h" | 9 #include "chrome/browser/sync/notifier/state_writer.h" |
10 #include "jingle/notifier/base/fake_base_task.h" | 10 #include "jingle/notifier/base/fake_base_task.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 class MockInvalidationClient : public invalidation::InvalidationClient { | 30 class MockInvalidationClient : public invalidation::InvalidationClient { |
31 public: | 31 public: |
32 MOCK_METHOD1(Start, void(const std::string& str)); | 32 MOCK_METHOD1(Start, void(const std::string& str)); |
33 MOCK_METHOD1(Register, void(const invalidation::ObjectId&)); | 33 MOCK_METHOD1(Register, void(const invalidation::ObjectId&)); |
34 MOCK_METHOD1(Unregister, void(const invalidation::ObjectId&)); | 34 MOCK_METHOD1(Unregister, void(const invalidation::ObjectId&)); |
35 MOCK_METHOD0(network_endpoint, invalidation::NetworkEndpoint*()); | 35 MOCK_METHOD0(network_endpoint, invalidation::NetworkEndpoint*()); |
36 }; | 36 }; |
37 | 37 |
38 namespace { | 38 namespace { |
39 const char kClientId[] = "client_id"; | 39 const char kClientId[] = "client_id"; |
| 40 const char kClientInfo[] = "client_info"; |
40 const char kState[] = "state"; | 41 const char kState[] = "state"; |
41 } // namespace | 42 } // namespace |
42 | 43 |
43 class ChromeInvalidationClientTest : public testing::Test { | 44 class ChromeInvalidationClientTest : public testing::Test { |
44 protected: | 45 protected: |
45 virtual void SetUp() { | 46 virtual void SetUp() { |
46 client_.Start(kClientId, kState, &mock_listener_, &mock_state_writer_, | 47 client_.Start(kClientId, kClientInfo, kState, |
| 48 &mock_listener_, &mock_state_writer_, |
47 fake_base_task_.AsWeakPtr()); | 49 fake_base_task_.AsWeakPtr()); |
48 } | 50 } |
49 | 51 |
50 virtual void TearDown() { | 52 virtual void TearDown() { |
51 client_.Stop(); | 53 client_.Stop(); |
52 message_loop_.RunAllPending(); | 54 message_loop_.RunAllPending(); |
53 } | 55 } |
54 | 56 |
55 // Simulates DoInformOutboundListener() from network-manager.cc. | 57 // Simulates DoInformOutboundListener() from network-manager.cc. |
56 virtual void SimulateInformOutboundListener() { | 58 virtual void SimulateInformOutboundListener() { |
(...skipping 30 matching lines...) Expand all Loading... |
87 notifier::FakeBaseTask fake_base_task2; | 89 notifier::FakeBaseTask fake_base_task2; |
88 client_.ChangeBaseTask(fake_base_task2.AsWeakPtr()); | 90 client_.ChangeBaseTask(fake_base_task2.AsWeakPtr()); |
89 } | 91 } |
90 | 92 |
91 SimulateInformOutboundListener(); | 93 SimulateInformOutboundListener(); |
92 } | 94 } |
93 | 95 |
94 // TODO(akalin): Flesh out unit tests. | 96 // TODO(akalin): Flesh out unit tests. |
95 | 97 |
96 } // namespace sync_notifier | 98 } // namespace sync_notifier |
OLD | NEW |