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