1 // Copyright 2014 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.
5 #ifndef ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_
6 #define ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_
8 #include "athena/activity/public/activity_manager_observer.h"
9 #include "base/macros.h"
14 // Listens for activities to be started / ended and will return them.
15 class ActivityLifetimeTracker
: public ActivityManagerObserver
{
17 ActivityLifetimeTracker();
18 ~ActivityLifetimeTracker() override
;
20 // ActivityManagerObserver:
21 void OnActivityStarted(Activity
* activity
) override
;
22 void OnActivityEnding(Activity
* activity
) override
;
23 void OnActivityOrderChanged() override
;
25 // Returns the newly created activity (if any) and resets its reference.
26 Activity
* GetNewActivityAndReset();
28 // Returns a deleted activity (if any) and resets its reference.
29 // Note that the pointer is void* since the Activity was deleted when
31 void* GetDeletedActivityAndReset();
34 // The activity which got created if not nullptr.
35 Activity
* new_activity_
;
37 // An old activity which got unloaded if not nullptr.
38 void* deleted_activity_
;
40 DISALLOW_COPY_AND_ASSIGN(ActivityLifetimeTracker
);
45 #endif // ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_