OLD | NEW |
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" | 5 #include "components/undo/undo_manager.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/undo/undo_manager_observer.h" | 10 #include "components/undo/undo_manager_observer.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 TestUndoService::~TestUndoService() { | 82 TestUndoService::~TestUndoService() { |
83 } | 83 } |
84 | 84 |
85 void TestUndoService::Redo() { | 85 void TestUndoService::Redo() { |
86 base::AutoReset<bool> incoming_changes(&performing_redo_, true); | 86 base::AutoReset<bool> incoming_changes(&performing_redo_, true); |
87 undo_manager_.Redo(); | 87 undo_manager_.Redo(); |
88 } | 88 } |
89 | 89 |
90 void TestUndoService::TriggerOperation() { | 90 void TestUndoService::TriggerOperation() { |
91 undo_manager_.AddUndoOperation(base::WrapUnique(new TestUndoOperation(this))); | 91 undo_manager_.AddUndoOperation(base::MakeUnique<TestUndoOperation>(this)); |
92 } | 92 } |
93 | 93 |
94 void TestUndoService::RecordUndoCall() { | 94 void TestUndoService::RecordUndoCall() { |
95 if (performing_redo_) | 95 if (performing_redo_) |
96 ++redo_operation_count_; | 96 ++redo_operation_count_; |
97 else | 97 else |
98 ++undo_operation_count_; | 98 ++undo_operation_count_; |
99 } | 99 } |
100 | 100 |
101 // TestObserver ---------------------------------------------------------------- | 101 // TestObserver ---------------------------------------------------------------- |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 undo_service.undo_manager_.Redo(); | 259 undo_service.undo_manager_.Redo(); |
260 int callback_count_after_redo = observer.state_change_count(); | 260 int callback_count_after_redo = observer.state_change_count(); |
261 EXPECT_GT(callback_count_after_redo, callback_count_after_undo); | 261 EXPECT_GT(callback_count_after_redo, callback_count_after_undo); |
262 | 262 |
263 undo_service.undo_manager_.RemoveObserver(&observer); | 263 undo_service.undo_manager_.RemoveObserver(&observer); |
264 undo_service.undo_manager_.Undo(); | 264 undo_service.undo_manager_.Undo(); |
265 EXPECT_EQ(callback_count_after_redo, observer.state_change_count()); | 265 EXPECT_EQ(callback_count_after_redo, observer.state_change_count()); |
266 } | 266 } |
267 | 267 |
268 } // namespace | 268 } // namespace |
OLD | NEW |