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

Unified Diff: athena/activity/activity_manager_unittest.cc

Issue 498023003: Delete activity upon window deletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/activity/activity_manager_impl.cc ('k') | athena/activity/activity_view_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/activity/activity_manager_unittest.cc
diff --git a/athena/activity/activity_manager_unittest.cc b/athena/activity/activity_manager_unittest.cc
index f94b6e8fe3d218847419f6e533a8b599ded8db2f..4374609fa9ad6f1b5f30348d8e26170c570226e2 100644
--- a/athena/activity/activity_manager_unittest.cc
+++ b/athena/activity/activity_manager_unittest.cc
@@ -2,14 +2,36 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "athena/activity/public/activity_manager.h"
+#include "athena/activity/activity_manager_impl.h"
+#include "athena/activity/public/activity.h"
#include "athena/activity/public/activity_factory.h"
#include "athena/test/athena_test_base.h"
+#include "ui/aura/window.h"
-typedef athena::test::AthenaTestBase ActivityManagerTest;
+namespace athena {
+
+typedef test::AthenaTestBase ActivityManagerTest;
TEST_F(ActivityManagerTest, Basic) {
- athena::ActivityManager::Get()->AddActivity(
+ ActivityManagerImpl* activity_manager =
+ static_cast<ActivityManagerImpl*>(ActivityManager::Get());
+ scoped_ptr<Activity> activity1(
athena::ActivityFactory::Get()->CreateWebActivity(NULL, GURL()));
+ activity_manager->AddActivity(activity1.get());
+ EXPECT_EQ(1, activity_manager->num_activities());
+
+ Activity* activity2 =
+ athena::ActivityFactory::Get()->CreateWebActivity(NULL, GURL());
+ activity_manager->AddActivity(activity2);
+ EXPECT_EQ(2, activity_manager->num_activities());
+
+ activity1.reset();
+ EXPECT_EQ(1, activity_manager->num_activities());
+
+ // Deleting the activity's window should delete the activity itself.
+ delete activity2->GetWindow();
+ EXPECT_EQ(0, activity_manager->num_activities());
}
+
+} // namespace athena
« no previous file with comments | « athena/activity/activity_manager_impl.cc ('k') | athena/activity/activity_view_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698