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

Side by Side Diff: components/sync/core_impl/protocol_event_buffer_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/protocol_event_buffer.h" 5 #include "components/sync/core_impl/protocol_event_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "sync/internal_api/public/events/poll_get_updates_request_event.h" 14 #include "components/sync/engine/events/poll_get_updates_request_event.h"
15 #include "sync/internal_api/public/events/protocol_event.h" 15 #include "components/sync/engine/events/protocol_event.h"
16 #include "sync/protocol/sync.pb.h" 16 #include "components/sync/protocol/sync.pb.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace syncer { 19 namespace syncer {
20 20
21 class ProtocolEventBufferTest : public ::testing::Test { 21 class ProtocolEventBufferTest : public ::testing::Test {
22 public: 22 public:
23 ProtocolEventBufferTest(); 23 ProtocolEventBufferTest();
24 ~ProtocolEventBufferTest() override; 24 ~ProtocolEventBufferTest() override;
25 25
26 static std::unique_ptr<ProtocolEvent> MakeTestEvent(int64_t id); 26 static std::unique_ptr<ProtocolEvent> MakeTestEvent(int64_t id);
(...skipping 27 matching lines...) Expand all
54 54
55 ScopedVector<ProtocolEvent> buffered_events( 55 ScopedVector<ProtocolEvent> buffered_events(
56 buffer_.GetBufferedProtocolEvents()); 56 buffer_.GetBufferedProtocolEvents());
57 57
58 ASSERT_EQ(2U, buffered_events.size()); 58 ASSERT_EQ(2U, buffered_events.size());
59 EXPECT_TRUE(HasId(*(buffered_events[0]), 1)); 59 EXPECT_TRUE(HasId(*(buffered_events[0]), 1));
60 EXPECT_TRUE(HasId(*(buffered_events[1]), 2)); 60 EXPECT_TRUE(HasId(*(buffered_events[1]), 2));
61 } 61 }
62 62
63 TEST_F(ProtocolEventBufferTest, AddThenOverflowThenReturnEvents) { 63 TEST_F(ProtocolEventBufferTest, AddThenOverflowThenReturnEvents) {
64 for (size_t i = 0; i < ProtocolEventBuffer::kBufferSize+1; ++i) { 64 for (size_t i = 0; i < ProtocolEventBuffer::kBufferSize + 1; ++i) {
65 std::unique_ptr<ProtocolEvent> e(MakeTestEvent(static_cast<int64_t>(i))); 65 std::unique_ptr<ProtocolEvent> e(MakeTestEvent(static_cast<int64_t>(i)));
66 buffer_.RecordProtocolEvent(*e); 66 buffer_.RecordProtocolEvent(*e);
67 } 67 }
68 68
69 ScopedVector<ProtocolEvent> buffered_events( 69 ScopedVector<ProtocolEvent> buffered_events(
70 buffer_.GetBufferedProtocolEvents()); 70 buffer_.GetBufferedProtocolEvents());
71 ASSERT_EQ(ProtocolEventBuffer::kBufferSize, buffered_events.size()); 71 ASSERT_EQ(ProtocolEventBuffer::kBufferSize, buffered_events.size());
72 72
73 for (size_t i = 1; i < ProtocolEventBuffer::kBufferSize+1; ++i) { 73 for (size_t i = 1; i < ProtocolEventBuffer::kBufferSize + 1; ++i) {
74 EXPECT_TRUE(HasId(*(buffered_events[i - 1]), static_cast<int64_t>(i))); 74 EXPECT_TRUE(HasId(*(buffered_events[i - 1]), static_cast<int64_t>(i)));
75 } 75 }
76 } 76 }
77 77
78
79 } // namespace syncer 78 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/core_impl/protocol_event_buffer.cc ('k') | components/sync/core_impl/sync_encryption_handler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698