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

Side by Side Diff: components/feature_engagement_tracker/internal/in_memory_store_unittest.cc

Issue 2834073003: Replace unique_ptr.reset(other_unique_ptr.release()) with std::move() in chrome (Closed)
Patch Set: Replace unique_ptr.reset(other_unique_ptr.release()) with std::move() in chrome Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "components/feature_engagement_tracker/internal/in_memory_store.h" 5 #include "components/feature_engagement_tracker/internal/in_memory_store.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace feature_engagement_tracker { 18 namespace feature_engagement_tracker {
18 19
19 namespace { 20 namespace {
20 21
21 class InMemoryStoreTest : public ::testing::Test { 22 class InMemoryStoreTest : public ::testing::Test {
22 public: 23 public:
23 InMemoryStoreTest() 24 InMemoryStoreTest()
24 : load_callback_has_been_invoked_(false), last_result_(false) {} 25 : load_callback_has_been_invoked_(false), last_result_(false) {}
25 26
26 void LoadCallback(bool success, std::unique_ptr<std::vector<Event>> events) { 27 void LoadCallback(bool success, std::unique_ptr<std::vector<Event>> events) {
27 load_callback_has_been_invoked_ = true; 28 load_callback_has_been_invoked_ = true;
28 last_result_ = success; 29 last_result_ = success;
29 loaded_events_.reset(events.release()); 30 loaded_events_ = std::move(events);
30 } 31 }
31 32
32 protected: 33 protected:
33 bool load_callback_has_been_invoked_; 34 bool load_callback_has_been_invoked_;
34 bool last_result_; 35 bool last_result_;
35 std::unique_ptr<std::vector<Event>> loaded_events_; 36 std::unique_ptr<std::vector<Event>> loaded_events_;
36 base::MessageLoop message_loop_; 37 base::MessageLoop message_loop_;
37 }; 38 };
38 } // namespace 39 } // namespace
39 40
(...skipping 20 matching lines...) Expand all
60 base::RunLoop().RunUntilIdle(); 61 base::RunLoop().RunUntilIdle();
61 62
62 // The two events should have been loaded, and the store should be ready. 63 // The two events should have been loaded, and the store should be ready.
63 EXPECT_TRUE(load_callback_has_been_invoked_); 64 EXPECT_TRUE(load_callback_has_been_invoked_);
64 EXPECT_TRUE(store.IsReady()); 65 EXPECT_TRUE(store.IsReady());
65 EXPECT_EQ(2u, loaded_events_->size()); 66 EXPECT_EQ(2u, loaded_events_->size());
66 EXPECT_TRUE(last_result_); 67 EXPECT_TRUE(last_result_);
67 } 68 }
68 69
69 } // namespace feature_engagement_tracker 70 } // namespace feature_engagement_tracker
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698