| 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.h" | 5 #include "athena/activity/public/activity.h" |
| 6 #include "athena/resource_manager/public/resource_manager.h" | 6 #include "athena/resource_manager/public/resource_manager.h" |
| 7 #include "athena/test/base/activity_lifetime_tracker.h" | 7 #include "athena/test/base/activity_lifetime_tracker.h" |
| 8 #include "athena/test/chrome/athena_app_browsertest.h" | 8 #include "athena/test/chrome/athena_app_browsertest.h" |
| 9 #include "athena/test/chrome/test_util.h" | 9 #include "athena/test/chrome/test_util.h" |
| 10 #include "athena/wm/public/window_list_provider.h" | 10 #include "athena/wm/public/window_list_provider.h" |
| 11 #include "athena/wm/public/window_manager.h" | 11 #include "athena/wm/public/window_manager.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "ui/aura/client/focus_client.h" | 13 #include "ui/aura/client/focus_client.h" |
| 14 #include "ui/wm/core/window_util.h" | 14 #include "ui/wm/core/window_util.h" |
| 15 | 15 |
| 16 namespace athena { | 16 namespace athena { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 // The test URL to navigate to. | 19 // The test URL to navigate to. |
| 20 const char kTestUrl[] = "chrome:about"; | 20 const char kTestUrl[] = "chrome:about"; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class AppActivityBrowserTest : public AthenaAppBrowserTest { | 23 class AppActivityBrowserTest : public AthenaAppBrowserTest { |
| 24 public: | 24 public: |
| 25 AppActivityBrowserTest() {} | 25 AppActivityBrowserTest() {} |
| 26 virtual ~AppActivityBrowserTest() {} | 26 ~AppActivityBrowserTest() override {} |
| 27 | 27 |
| 28 // AthenaAppBrowserTest: | 28 // AthenaAppBrowserTest: |
| 29 virtual void SetUpOnMainThread() override { | 29 void SetUpOnMainThread() override { |
| 30 tracker_.reset(new ActivityLifetimeTracker); | 30 tracker_.reset(new ActivityLifetimeTracker); |
| 31 AthenaAppBrowserTest::SetUpOnMainThread(); | 31 AthenaAppBrowserTest::SetUpOnMainThread(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void TearDownOnMainThread() override { | 34 void TearDownOnMainThread() override { |
| 35 tracker_.reset(); | 35 tracker_.reset(); |
| 36 AthenaAppBrowserTest::TearDownOnMainThread(); | 36 AthenaAppBrowserTest::TearDownOnMainThread(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 // A |proxy_activity| got deleted and this function waits, using the |tracker| | 40 // A |proxy_activity| got deleted and this function waits, using the |tracker| |
| 41 // until the application got restarted returning the new application activity. | 41 // until the application got restarted returning the new application activity. |
| 42 Activity* WaitForProxyDestruction(Activity* proxy_activity) { | 42 Activity* WaitForProxyDestruction(Activity* proxy_activity) { |
| 43 ActivityLifetimeTracker tracker; | 43 ActivityLifetimeTracker tracker; |
| 44 void* deleted_activity = nullptr; | 44 void* deleted_activity = nullptr; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 proxy_activity = nullptr; // The proxy is gone now. | 200 proxy_activity = nullptr; // The proxy is gone now. |
| 201 | 201 |
| 202 // After this, the application should remain at its current location in the | 202 // After this, the application should remain at its current location in the |
| 203 // stack and the activation focus should remain on the current window as well. | 203 // stack and the activation focus should remain on the current window as well. |
| 204 EXPECT_EQ(app_activity->GetWindow(), windows[1]); | 204 EXPECT_EQ(app_activity->GetWindow(), windows[1]); |
| 205 EXPECT_TRUE(IsActivityActive(app_activity)); | 205 EXPECT_TRUE(IsActivityActive(app_activity)); |
| 206 EXPECT_EQ(web_activity->GetWindow(), windows[0]); | 206 EXPECT_EQ(web_activity->GetWindow(), windows[0]); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace athena | 209 } // namespace athena |
| OLD | NEW |