| 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_content_control_delegate.h" | 9 #include "athena/content/public/app_content_control_delegate.h" |
| 10 #include "athena/content/public/app_registry.h" | 10 #include "athena/content/public/app_registry.h" |
| 11 #include "athena/test/athena_test_base.h" | 11 #include "athena/test/athena_test_base.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 | 15 |
| 16 | |
| 17 namespace content { | 16 namespace content { |
| 18 class BrowserContext; | 17 class BrowserContext; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace athena { | 20 namespace athena { |
| 22 namespace test { | 21 namespace test { |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 // An identifier for the running apps. | 25 // An identifier for the running apps. |
| 27 const char kDummyApp1[] = "aaaaaaa"; | 26 const char kDummyApp1[] = "aaaaaaa"; |
| 28 const char kDummyApp2[] = "bbbbbbb"; | 27 const char kDummyApp2[] = "bbbbbbb"; |
| 29 | 28 |
| 30 // A dummy test app activity which works without content / ShellAppWindow. | 29 // A dummy test app activity which works without content / ShellAppWindow. |
| 31 class TestAppActivity : public AppActivity { | 30 class TestAppActivity : public AppActivity { |
| 32 public: | 31 public: |
| 33 explicit TestAppActivity(const std::string& app_id) : | 32 explicit TestAppActivity(const std::string& app_id) : |
| 34 AppActivity(NULL), | 33 AppActivity(), |
| 35 app_id_(app_id), | 34 app_id_(app_id), |
| 36 view_(new views::View()), | 35 view_(new views::View()), |
| 37 current_state_(ACTIVITY_VISIBLE) { | 36 current_state_(ACTIVITY_VISIBLE) { |
| 38 app_activity_registry_ = | 37 app_activity_registry_ = |
| 39 AppRegistry::Get()->GetAppActivityRegistry(app_id, NULL); | 38 AppRegistry::Get()->GetAppActivityRegistry(app_id, NULL); |
| 40 app_activity_registry_->RegisterAppActivity(this); | 39 app_activity_registry_->RegisterAppActivity(this); |
| 41 } | 40 } |
| 42 virtual ~TestAppActivity() { | 41 virtual ~TestAppActivity() { |
| 43 app_activity_registry_->UnregisterAppActivity(this); | 42 app_activity_registry_->UnregisterAppActivity(this); |
| 44 } | 43 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 60 virtual bool IsVisible() OVERRIDE { | 59 virtual bool IsVisible() OVERRIDE { |
| 61 return true; | 60 return true; |
| 62 } | 61 } |
| 63 virtual ActivityMediaState GetMediaState() OVERRIDE { | 62 virtual ActivityMediaState GetMediaState() OVERRIDE { |
| 64 return Activity::ACTIVITY_MEDIA_STATE_NONE; | 63 return Activity::ACTIVITY_MEDIA_STATE_NONE; |
| 65 } | 64 } |
| 66 virtual aura::Window* GetWindow() OVERRIDE { | 65 virtual aura::Window* GetWindow() OVERRIDE { |
| 67 return view_->GetWidget()->GetNativeWindow(); | 66 return view_->GetWidget()->GetNativeWindow(); |
| 68 } | 67 } |
| 69 | 68 |
| 69 // AppActivity: |
| 70 virtual content::WebContents* GetWebContents() OVERRIDE { |
| 71 return NULL; |
| 72 } |
| 73 |
| 70 // ActivityViewModel: | 74 // ActivityViewModel: |
| 71 virtual void Init() OVERRIDE {} | 75 virtual void Init() OVERRIDE {} |
| 72 virtual SkColor GetRepresentativeColor() const OVERRIDE { return 0; } | 76 virtual SkColor GetRepresentativeColor() const OVERRIDE { return 0; } |
| 73 virtual base::string16 GetTitle() const OVERRIDE { return title_; } | 77 virtual base::string16 GetTitle() const OVERRIDE { return title_; } |
| 74 virtual bool UsesFrame() const OVERRIDE { return true; } | 78 virtual bool UsesFrame() const OVERRIDE { return true; } |
| 75 virtual views::View* GetContentsView() OVERRIDE { return view_; } | 79 virtual views::View* GetContentsView() OVERRIDE { return view_; } |
| 76 virtual void CreateOverviewModeImage() OVERRIDE {} | 80 virtual void CreateOverviewModeImage() OVERRIDE {} |
| 77 | 81 |
| 78 private: | 82 private: |
| 79 // If known the registry which holds all activities for the associated app. | 83 // If known the registry which holds all activities for the associated app. |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 activity_proxy->SetCurrentState(Activity::ACTIVITY_VISIBLE); | 406 activity_proxy->SetCurrentState(Activity::ACTIVITY_VISIBLE); |
| 403 EXPECT_EQ(1, test_app_content_control_delegate()->restart_called()); | 407 EXPECT_EQ(1, test_app_content_control_delegate()->restart_called()); |
| 404 | 408 |
| 405 // However - the restart in this test framework does not really restart and | 409 // However - the restart in this test framework does not really restart and |
| 406 // all objects should be gone now. | 410 // all objects should be gone now. |
| 407 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); | 411 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); |
| 408 } | 412 } |
| 409 | 413 |
| 410 } // namespace test | 414 } // namespace test |
| 411 } // namespace athena | 415 } // namespace athena |
| OLD | NEW |