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

Side by Side Diff: base/test/user_action_tester.cc

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/test/user_action_tester.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9
10 namespace base {
11
12 UserActionTester::UserActionTester()
13 : action_callback_(
14 base::Bind(&UserActionTester::OnUserAction, base::Unretained(this))) {
15 base::AddActionCallback(action_callback_);
16 }
17
18 UserActionTester::~UserActionTester() {
19 base::RemoveActionCallback(action_callback_);
20 }
21
22 int UserActionTester::GetActionCount(const std::string& user_action) const {
23 UserActionCountMap::const_iterator iter = count_map_.find(user_action);
24 return iter == count_map_.end() ? 0 : iter->second;
25 }
26
27 void UserActionTester::ResetCounts() {
28 count_map_.clear();
29 }
30
31 void UserActionTester::OnUserAction(const std::string& user_action) {
32 ++(count_map_[user_action]);
33 }
34
35 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698