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

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

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 #ifndef BASE_TEST_USER_ACTION_TESTER_H_
6 #define BASE_TEST_USER_ACTION_TESTER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/metrics/user_metrics.h"
12
13 namespace base {
14
15 // This class observes and collects user action notifications that are sent
16 // by the tests, so that they can be examined afterwards for correctness.
17 // Note: This class is NOT thread-safe.
18 class UserActionTester {
19 public:
20 UserActionTester();
21 ~UserActionTester();
22
23 // Returns the number of times the given |user_action| occurred.
24 int GetActionCount(const std::string& user_action) const;
25
26 // Resets all user action counts to 0.
27 void ResetCounts();
28
29 private:
30 typedef std::map<std::string, int> UserActionCountMap;
31
32 // The callback that is notified when a user actions occurs.
33 void OnUserAction(const std::string& user_action);
34
35 // A map that tracks the number of times a user action has occurred.
36 UserActionCountMap count_map_;
37
38 // The callback that is added to the global action callback list.
39 base::ActionCallback action_callback_;
40
41 DISALLOW_COPY_AND_ASSIGN(UserActionTester);
42 };
43
44 } // namespace base
45
46 #endif // BASE_TEST_USER_ACTION_TESTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698