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

Side by Side Diff: chrome/browser/undo/undo_manager_test.cc

Issue 660873002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « chrome/browser/ui/views/extensions/extension_message_bubble_view.cc ('k') | no next file » | 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 "base/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "chrome/browser/undo/undo_manager.h" 6 #include "chrome/browser/undo/undo_manager.h"
7 #include "chrome/browser/undo/undo_manager_observer.h" 7 #include "chrome/browser/undo/undo_manager_observer.h"
8 #include "chrome/browser/undo/undo_operation.h" 8 #include "chrome/browser/undo/undo_operation.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 TestUndoService::~TestUndoService() { 79 TestUndoService::~TestUndoService() {
80 } 80 }
81 81
82 void TestUndoService::Redo() { 82 void TestUndoService::Redo() {
83 base::AutoReset<bool> incoming_changes(&performing_redo_, true); 83 base::AutoReset<bool> incoming_changes(&performing_redo_, true);
84 undo_manager_.Redo(); 84 undo_manager_.Redo();
85 } 85 }
86 86
87 void TestUndoService::TriggerOperation() { 87 void TestUndoService::TriggerOperation() {
88 scoped_ptr<TestUndoOperation> op(new TestUndoOperation(this)); 88 undo_manager_.AddUndoOperation(make_scoped_ptr(new TestUndoOperation(this)));
89 undo_manager_.AddUndoOperation(op.PassAs<UndoOperation>());
90 } 89 }
91 90
92 void TestUndoService::RecordUndoCall() { 91 void TestUndoService::RecordUndoCall() {
93 if (performing_redo_) 92 if (performing_redo_)
94 ++redo_operation_count_; 93 ++redo_operation_count_;
95 else 94 else
96 ++undo_operation_count_; 95 ++undo_operation_count_;
97 } 96 }
98 97
99 // TestObserver ---------------------------------------------------------------- 98 // TestObserver ----------------------------------------------------------------
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 undo_service.undo_manager_.Redo(); 256 undo_service.undo_manager_.Redo();
258 int callback_count_after_redo = observer.state_change_count(); 257 int callback_count_after_redo = observer.state_change_count();
259 EXPECT_GT(callback_count_after_redo, callback_count_after_undo); 258 EXPECT_GT(callback_count_after_redo, callback_count_after_undo);
260 259
261 undo_service.undo_manager_.RemoveObserver(&observer); 260 undo_service.undo_manager_.RemoveObserver(&observer);
262 undo_service.undo_manager_.Undo(); 261 undo_service.undo_manager_.Undo();
263 EXPECT_EQ(callback_count_after_redo, observer.state_change_count()); 262 EXPECT_EQ(callback_count_after_redo, observer.state_change_count());
264 } 263 }
265 264
266 } // namespace 265 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_message_bubble_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698