OLD | NEW |
1 /// Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "athena/activity/public/activity_manager.h" | 5 #include "athena/activity/activity_manager_impl.h" |
6 | 6 |
| 7 #include "athena/activity/public/activity.h" |
7 #include "athena/activity/public/activity_factory.h" | 8 #include "athena/activity/public/activity_factory.h" |
8 #include "athena/test/athena_test_base.h" | 9 #include "athena/test/athena_test_base.h" |
| 10 #include "ui/aura/window.h" |
9 | 11 |
10 typedef athena::test::AthenaTestBase ActivityManagerTest; | 12 namespace athena { |
| 13 |
| 14 typedef test::AthenaTestBase ActivityManagerTest; |
11 | 15 |
12 TEST_F(ActivityManagerTest, Basic) { | 16 TEST_F(ActivityManagerTest, Basic) { |
13 athena::ActivityManager::Get()->AddActivity( | 17 ActivityManagerImpl* activity_manager = |
| 18 static_cast<ActivityManagerImpl*>(ActivityManager::Get()); |
| 19 scoped_ptr<Activity> activity1( |
14 athena::ActivityFactory::Get()->CreateWebActivity(NULL, GURL())); | 20 athena::ActivityFactory::Get()->CreateWebActivity(NULL, GURL())); |
| 21 activity_manager->AddActivity(activity1.get()); |
| 22 EXPECT_EQ(1, activity_manager->num_activities()); |
| 23 |
| 24 Activity* activity2 = |
| 25 athena::ActivityFactory::Get()->CreateWebActivity(NULL, GURL()); |
| 26 activity_manager->AddActivity(activity2); |
| 27 EXPECT_EQ(2, activity_manager->num_activities()); |
| 28 |
| 29 activity1.reset(); |
| 30 EXPECT_EQ(1, activity_manager->num_activities()); |
| 31 |
| 32 // Deleting the activity's window should delete the activity itself. |
| 33 delete activity2->GetWindow(); |
| 34 EXPECT_EQ(0, activity_manager->num_activities()); |
15 } | 35 } |
| 36 |
| 37 } // namespace athena |
OLD | NEW |