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 EXPECT_EQ(1, activity_manager->num_activities()); | 21 EXPECT_EQ(1, activity_manager->num_activities()); |
22 | 22 |
| 23 // Activity is not visible when created. |
| 24 EXPECT_FALSE(activity1->GetWindow()->TargetVisibility()); |
| 25 Activity::Show(activity1); |
| 26 EXPECT_TRUE(activity1->GetWindow()->TargetVisibility()); |
| 27 |
23 Activity* activity2 = athena::ActivityFactory::Get()->CreateWebActivity( | 28 Activity* activity2 = athena::ActivityFactory::Get()->CreateWebActivity( |
24 NULL, base::string16(), GURL()); | 29 NULL, base::string16(), GURL()); |
25 EXPECT_EQ(2, activity_manager->num_activities()); | 30 EXPECT_EQ(2, activity_manager->num_activities()); |
26 | 31 |
27 Activity::Delete(activity1); | 32 Activity::Delete(activity1); |
28 EXPECT_EQ(1, activity_manager->num_activities()); | 33 EXPECT_EQ(1, activity_manager->num_activities()); |
29 | 34 |
30 // Deleting the activity's window should delete the activity itself. | 35 // Deleting the activity's window should delete the activity itself. |
31 delete activity2->GetWindow(); | 36 delete activity2->GetWindow(); |
32 EXPECT_EQ(0, activity_manager->num_activities()); | 37 EXPECT_EQ(0, activity_manager->num_activities()); |
33 } | 38 } |
34 | 39 |
35 } // namespace athena | 40 } // namespace athena |
OLD | NEW |