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 #include "athena/activity/activity_manager_impl.h"
7 #include "athena/activity/public/activity.h"
8 #include "athena/activity/public/activity_factory.h"
9 #include "athena/test/athena_test_base.h"
10 #include "ui/aura/window.h"
14 typedef test::AthenaTestBase ActivityManagerTest
;
16 TEST_F(ActivityManagerTest
, Basic
) {
17 ActivityManagerImpl
* activity_manager
=
18 static_cast<ActivityManagerImpl
*>(ActivityManager::Get());
19 scoped_ptr
<Activity
> activity1(
20 athena::ActivityFactory::Get()->CreateWebActivity(NULL
, GURL()));
21 activity_manager
->AddActivity(activity1
.get());
22 EXPECT_EQ(1, activity_manager
->num_activities());
25 athena::ActivityFactory::Get()->CreateWebActivity(NULL
, GURL());
26 activity_manager
->AddActivity(activity2
);
27 EXPECT_EQ(2, activity_manager
->num_activities());
30 EXPECT_EQ(1, activity_manager
->num_activities());
32 // Deleting the activity's window should delete the activity itself.
33 delete activity2
->GetWindow();
34 EXPECT_EQ(0, activity_manager
->num_activities());