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_factory.h" | 5 #include "athena/activity/public/activity_factory.h" |
6 #include "athena/activity/public/activity_manager.h" | 6 #include "athena/activity/public/activity_manager.h" |
7 #include "athena/content/app_activity.h" | 7 #include "athena/content/app_activity.h" |
8 #include "athena/content/app_activity_registry.h" | 8 #include "athena/content/app_activity_registry.h" |
9 #include "athena/content/public/app_registry.h" | 9 #include "athena/content/public/app_registry.h" |
10 #include "athena/extensions/public/extensions_delegate.h" | 10 #include "athena/extensions/public/extensions_delegate.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // Close the proxy object and make sure that nothing bad happens. | 303 // Close the proxy object and make sure that nothing bad happens. |
304 DeleteActivity(activity_proxy); | 304 DeleteActivity(activity_proxy); |
305 | 305 |
306 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); | 306 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); |
307 EXPECT_EQ(1, test_extensions_delegate()->unload_called()); | 307 EXPECT_EQ(1, test_extensions_delegate()->unload_called()); |
308 EXPECT_EQ(0, test_extensions_delegate()->restart_called()); | 308 EXPECT_EQ(0, test_extensions_delegate()->restart_called()); |
309 } | 309 } |
310 | 310 |
311 // Test that when unloading an app while multiple apps / activities are present, | 311 // Test that when unloading an app while multiple apps / activities are present, |
312 // the proxy gets created in the correct location. | 312 // the proxy gets created in the correct location. |
313 // Flaky: http://crbug.com/416843. | 313 TEST_F(AppActivityTest, TestUnloadProxyLocation) { |
314 TEST_F(AppActivityTest, DISABLED_TestUnloadProxyLocation) { | 314 // Disable the resource manager since some build bots run this test for an |
| 315 // extended amount of time which allows the MemoryPressureNotifier to fire. |
| 316 DisableResourceManager(); |
315 // Set up some activities for some applications. | 317 // Set up some activities for some applications. |
316 TestAppActivity* app_activity1a = CreateAppActivity(kDummyApp1); | 318 TestAppActivity* app_activity1a = CreateAppActivity(kDummyApp1); |
317 TestAppActivity* app_activity2a = CreateAppActivity(kDummyApp2); | 319 TestAppActivity* app_activity2a = CreateAppActivity(kDummyApp2); |
318 TestAppActivity* app_activity2b = CreateAppActivity(kDummyApp2); | 320 TestAppActivity* app_activity2b = CreateAppActivity(kDummyApp2); |
319 TestAppActivity* app_activity1b = CreateAppActivity(kDummyApp1); | 321 TestAppActivity* app_activity1b = CreateAppActivity(kDummyApp1); |
320 EXPECT_EQ(3, GetActivityPosition(app_activity1b)); | 322 EXPECT_EQ(3, GetActivityPosition(app_activity1b)); |
321 EXPECT_EQ(2, GetActivityPosition(app_activity2b)); | 323 EXPECT_EQ(2, GetActivityPosition(app_activity2b)); |
322 EXPECT_EQ(1, GetActivityPosition(app_activity2a)); | 324 EXPECT_EQ(1, GetActivityPosition(app_activity2a)); |
323 EXPECT_EQ(0, GetActivityPosition(app_activity1a)); | 325 EXPECT_EQ(0, GetActivityPosition(app_activity1a)); |
324 | 326 |
(...skipping 12 matching lines...) Expand all Loading... |
337 EXPECT_EQ(0, GetActivityPosition(app_activity1a)); | 339 EXPECT_EQ(0, GetActivityPosition(app_activity1a)); |
338 EXPECT_EQ(0, test_extensions_delegate()->restart_called()); | 340 EXPECT_EQ(0, test_extensions_delegate()->restart_called()); |
339 | 341 |
340 DeleteActivity(activity_proxy); | 342 DeleteActivity(activity_proxy); |
341 DeleteActivity(app_activity1b); | 343 DeleteActivity(app_activity1b); |
342 DeleteActivity(app_activity1a); | 344 DeleteActivity(app_activity1a); |
343 } | 345 } |
344 | 346 |
345 // Test that an unload with multiple activities of the same app will only unload | 347 // Test that an unload with multiple activities of the same app will only unload |
346 // when all activities were marked for unloading. | 348 // when all activities were marked for unloading. |
347 // Flaky: http://crbug.com/417189. | 349 TEST_F(AppActivityTest, TestMultipleActivityUnloadLock) { |
348 TEST_F(AppActivityTest, DISABLED_TestMultipleActivityUnloadLock) { | 350 // Disable the resource manager since some build bots run this test for an |
| 351 // extended amount of time which allows the MemoryPressureNotifier to fire. |
| 352 DisableResourceManager(); |
| 353 |
349 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); | 354 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); |
350 | 355 |
351 TestAppActivity* app_activity1 = CreateAppActivity(kDummyApp1); | 356 TestAppActivity* app_activity1 = CreateAppActivity(kDummyApp1); |
352 TestAppActivity* app_activity2 = CreateAppActivity(kDummyApp1); | 357 TestAppActivity* app_activity2 = CreateAppActivity(kDummyApp1); |
353 TestAppActivity* app_activity3 = CreateAppActivity(kDummyApp1); | 358 TestAppActivity* app_activity3 = CreateAppActivity(kDummyApp1); |
354 | 359 |
355 // Check that we have 3 activities of the same application. | 360 // Check that we have 3 activities of the same application. |
356 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications()); | 361 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications()); |
357 AppActivityRegistry* app_activity_registry = | 362 AppActivityRegistry* app_activity_registry = |
358 app_activity1->app_activity_registry(); | 363 app_activity1->app_activity_registry(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // However - the restart in this test framework does not really restart and | 426 // However - the restart in this test framework does not really restart and |
422 // all objects should be still there.. | 427 // all objects should be still there.. |
423 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications()); | 428 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications()); |
424 EXPECT_TRUE(app_activity_registry->unloaded_activity_proxy()); | 429 EXPECT_TRUE(app_activity_registry->unloaded_activity_proxy()); |
425 Activity::Delete(app_activity_registry->unloaded_activity_proxy()); | 430 Activity::Delete(app_activity_registry->unloaded_activity_proxy()); |
426 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); | 431 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); |
427 } | 432 } |
428 | 433 |
429 } // namespace test | 434 } // namespace test |
430 } // namespace athena | 435 } // namespace athena |
OLD | NEW |