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

Side by Side Diff: components/undo/undo_manager_test.cc

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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
« no previous file with comments | « components/undo/undo_manager.cc ('k') | components/url_formatter/url_formatter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/undo/undo_manager.h"
6
5 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
6 #include "base/macros.h" 8 #include "base/macros.h"
7 #include "components/undo/undo_manager.h" 9 #include "base/memory/ptr_util.h"
8 #include "components/undo/undo_manager_observer.h" 10 #include "components/undo/undo_manager_observer.h"
9 #include "components/undo/undo_operation.h" 11 #include "components/undo/undo_operation.h"
10 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
11 13
12 namespace { 14 namespace {
13 15
14 class TestUndoOperation; 16 class TestUndoOperation;
15 17
16 // TestUndoService ------------------------------------------------------------- 18 // TestUndoService -------------------------------------------------------------
17 19
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 81
80 TestUndoService::~TestUndoService() { 82 TestUndoService::~TestUndoService() {
81 } 83 }
82 84
83 void TestUndoService::Redo() { 85 void TestUndoService::Redo() {
84 base::AutoReset<bool> incoming_changes(&performing_redo_, true); 86 base::AutoReset<bool> incoming_changes(&performing_redo_, true);
85 undo_manager_.Redo(); 87 undo_manager_.Redo();
86 } 88 }
87 89
88 void TestUndoService::TriggerOperation() { 90 void TestUndoService::TriggerOperation() {
89 undo_manager_.AddUndoOperation(make_scoped_ptr(new TestUndoOperation(this))); 91 undo_manager_.AddUndoOperation(base::WrapUnique(new TestUndoOperation(this)));
90 } 92 }
91 93
92 void TestUndoService::RecordUndoCall() { 94 void TestUndoService::RecordUndoCall() {
93 if (performing_redo_) 95 if (performing_redo_)
94 ++redo_operation_count_; 96 ++redo_operation_count_;
95 else 97 else
96 ++undo_operation_count_; 98 ++undo_operation_count_;
97 } 99 }
98 100
99 // TestObserver ---------------------------------------------------------------- 101 // TestObserver ----------------------------------------------------------------
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 undo_service.undo_manager_.Redo(); 259 undo_service.undo_manager_.Redo();
258 int callback_count_after_redo = observer.state_change_count(); 260 int callback_count_after_redo = observer.state_change_count();
259 EXPECT_GT(callback_count_after_redo, callback_count_after_undo); 261 EXPECT_GT(callback_count_after_redo, callback_count_after_undo);
260 262
261 undo_service.undo_manager_.RemoveObserver(&observer); 263 undo_service.undo_manager_.RemoveObserver(&observer);
262 undo_service.undo_manager_.Undo(); 264 undo_service.undo_manager_.Undo();
263 EXPECT_EQ(callback_count_after_redo, observer.state_change_count()); 265 EXPECT_EQ(callback_count_after_redo, observer.state_change_count());
264 } 266 }
265 267
266 } // namespace 268 } // namespace
OLDNEW
« no previous file with comments | « components/undo/undo_manager.cc ('k') | components/url_formatter/url_formatter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698