Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Side by Side Diff: athena/activity/activity_manager_unittest.cc

Issue 694353004: athena: Expose the list of activities from the ActivityManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « athena/activity/activity_manager_impl.cc ('k') | athena/activity/public/activity_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/athena_test_base.h" 9 #include "athena/test/base/athena_test_base.h"
10 #include "athena/test/base/test_windows.h" 10 #include "athena/test/base/test_windows.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/wm/core/window_util.h"
12 13
13 namespace athena { 14 namespace athena {
14 15
15 typedef test::AthenaTestBase ActivityManagerTest; 16 typedef test::AthenaTestBase ActivityManagerTest;
16 17
17 TEST_F(ActivityManagerTest, Basic) { 18 TEST_F(ActivityManagerTest, Basic) {
18 ActivityManagerImpl* activity_manager = 19 ActivityManagerImpl* activity_manager =
19 static_cast<ActivityManagerImpl*>(ActivityManager::Get()); 20 static_cast<ActivityManagerImpl*>(ActivityManager::Get());
20 ActivityFactory* factory = ActivityFactory::Get(); 21 ActivityFactory* factory = ActivityFactory::Get();
21 22
(...skipping 29 matching lines...) Expand all
51 52
52 EXPECT_EQ(activity1, manager->GetActivityForWindow(activity1->GetWindow())); 53 EXPECT_EQ(activity1, manager->GetActivityForWindow(activity1->GetWindow()));
53 EXPECT_EQ(activity2, manager->GetActivityForWindow(activity2->GetWindow())); 54 EXPECT_EQ(activity2, manager->GetActivityForWindow(activity2->GetWindow()));
54 55
55 EXPECT_EQ(nullptr, manager->GetActivityForWindow(nullptr)); 56 EXPECT_EQ(nullptr, manager->GetActivityForWindow(nullptr));
56 57
57 scoped_ptr<aura::Window> window = test::CreateNormalWindow(nullptr, nullptr); 58 scoped_ptr<aura::Window> window = test::CreateNormalWindow(nullptr, nullptr);
58 EXPECT_EQ(nullptr, manager->GetActivityForWindow(window.get())); 59 EXPECT_EQ(nullptr, manager->GetActivityForWindow(window.get()));
59 } 60 }
60 61
62 TEST_F(ActivityManagerTest, ActivationBringsActivityToTop) {
63 ActivityManager* manager = ActivityManager::Get();
64 ActivityFactory* factory = ActivityFactory::Get();
65
66 Activity* activity1 =
67 factory->CreateWebActivity(nullptr, base::string16(), GURL());
68 Activity* activity2 =
69 factory->CreateWebActivity(nullptr, base::string16(), GURL());
70 activity1->GetWindow()->Show();
71 activity2->GetWindow()->Show();
72
73 ASSERT_EQ(2u, manager->GetActivityList().size());
74 EXPECT_EQ(activity2, manager->GetActivityList()[0]);
75 EXPECT_EQ(activity1, manager->GetActivityList()[1]);
76
77 wm::ActivateWindow(activity1->GetWindow());
78 ASSERT_EQ(2u, manager->GetActivityList().size());
79 EXPECT_EQ(activity1, manager->GetActivityList()[0]);
80 EXPECT_EQ(activity2, manager->GetActivityList()[1]);
81 }
82
61 } // namespace athena 83 } // namespace athena
OLDNEW
« no previous file with comments | « athena/activity/activity_manager_impl.cc ('k') | athena/activity/public/activity_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698