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

Side by Side Diff: athena/content/app_activity_unittest.cc

Issue 623103002: replace OVERRIDE and FINAL with override and final in athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « athena/content/app_activity_proxy.h ('k') | athena/content/app_registry_impl.cc » ('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/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 30 matching lines...) Expand all
41 } 41 }
42 virtual ~TestAppActivity() { 42 virtual ~TestAppActivity() {
43 app_activity_registry_->UnregisterAppActivity(this); 43 app_activity_registry_->UnregisterAppActivity(this);
44 } 44 }
45 45
46 AppActivityRegistry* app_activity_registry() { 46 AppActivityRegistry* app_activity_registry() {
47 return app_activity_registry_; 47 return app_activity_registry_;
48 } 48 }
49 49
50 // Activity: 50 // Activity:
51 virtual ActivityViewModel* GetActivityViewModel() OVERRIDE { 51 virtual ActivityViewModel* GetActivityViewModel() override {
52 return this; 52 return this;
53 } 53 }
54 virtual void SetCurrentState(Activity::ActivityState state) OVERRIDE { 54 virtual void SetCurrentState(Activity::ActivityState state) override {
55 current_state_ = state; 55 current_state_ = state;
56 if (state == ACTIVITY_UNLOADED) 56 if (state == ACTIVITY_UNLOADED)
57 app_activity_registry_->Unload(); 57 app_activity_registry_->Unload();
58 } 58 }
59 virtual ActivityState GetCurrentState() OVERRIDE { 59 virtual ActivityState GetCurrentState() override {
60 return current_state_; 60 return current_state_;
61 } 61 }
62 virtual bool IsVisible() OVERRIDE { 62 virtual bool IsVisible() override {
63 return true; 63 return true;
64 } 64 }
65 virtual ActivityMediaState GetMediaState() OVERRIDE { 65 virtual ActivityMediaState GetMediaState() override {
66 return Activity::ACTIVITY_MEDIA_STATE_NONE; 66 return Activity::ACTIVITY_MEDIA_STATE_NONE;
67 } 67 }
68 virtual aura::Window* GetWindow() OVERRIDE { 68 virtual aura::Window* GetWindow() override {
69 return view_->GetWidget()->GetNativeWindow(); 69 return view_->GetWidget()->GetNativeWindow();
70 } 70 }
71 71
72 // ActivityViewModel: 72 // ActivityViewModel:
73 virtual void Init() OVERRIDE {} 73 virtual void Init() override {}
74 virtual SkColor GetRepresentativeColor() const OVERRIDE { return 0; } 74 virtual SkColor GetRepresentativeColor() const override { return 0; }
75 virtual base::string16 GetTitle() const OVERRIDE { return title_; } 75 virtual base::string16 GetTitle() const override { return title_; }
76 virtual bool UsesFrame() const OVERRIDE { return true; } 76 virtual bool UsesFrame() const override { return true; }
77 virtual views::View* GetContentsView() OVERRIDE { return view_; } 77 virtual views::View* GetContentsView() override { return view_; }
78 virtual views::Widget* CreateWidget() OVERRIDE { return NULL; } 78 virtual views::Widget* CreateWidget() override { return NULL; }
79 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE { 79 virtual gfx::ImageSkia GetOverviewModeImage() override {
80 return gfx::ImageSkia(); 80 return gfx::ImageSkia();
81 } 81 }
82 82
83 private: 83 private:
84 // If known the registry which holds all activities for the associated app. 84 // If known the registry which holds all activities for the associated app.
85 AppActivityRegistry* app_activity_registry_; 85 AppActivityRegistry* app_activity_registry_;
86 86
87 // The title of the activity. 87 // The title of the activity.
88 base::string16 title_; 88 base::string16 title_;
89 89
90 // Our view. 90 // Our view.
91 views::View* view_; 91 views::View* view_;
92 92
93 // The current state for this activity. 93 // The current state for this activity.
94 ActivityState current_state_; 94 ActivityState current_state_;
95 95
96 DISALLOW_COPY_AND_ASSIGN(TestAppActivity); 96 DISALLOW_COPY_AND_ASSIGN(TestAppActivity);
97 }; 97 };
98 98
99 // An AppContentDelegateClass which we can query for call stats. 99 // An AppContentDelegateClass which we can query for call stats.
100 class TestExtensionsDelegate : public ExtensionsDelegate { 100 class TestExtensionsDelegate : public ExtensionsDelegate {
101 public: 101 public:
102 TestExtensionsDelegate() : unload_called_(0), restart_called_(0) {} 102 TestExtensionsDelegate() : unload_called_(0), restart_called_(0) {}
103 virtual ~TestExtensionsDelegate() {} 103 virtual ~TestExtensionsDelegate() {}
104 104
105 int unload_called() const { return unload_called_; } 105 int unload_called() const { return unload_called_; }
106 int restart_called() const { return restart_called_; } 106 int restart_called() const { return restart_called_; }
107 107
108 // ExtensionsDelegate: 108 // ExtensionsDelegate:
109 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE { 109 virtual content::BrowserContext* GetBrowserContext() const override {
110 return NULL; 110 return NULL;
111 } 111 }
112 virtual const extensions::ExtensionSet& GetInstalledExtensions() OVERRIDE { 112 virtual const extensions::ExtensionSet& GetInstalledExtensions() override {
113 return extension_set_; 113 return extension_set_;
114 } 114 }
115 // Unload an application. Returns true when unloaded. 115 // Unload an application. Returns true when unloaded.
116 virtual bool UnloadApp(const std::string& app_id) OVERRIDE { 116 virtual bool UnloadApp(const std::string& app_id) override {
117 unload_called_++; 117 unload_called_++;
118 // Since we did not close anything we let the framework clean up. 118 // Since we did not close anything we let the framework clean up.
119 return false; 119 return false;
120 } 120 }
121 // Restarts an application. Returns true when the restart was initiated. 121 // Restarts an application. Returns true when the restart was initiated.
122 virtual bool LaunchApp(const std::string& app_id) OVERRIDE { 122 virtual bool LaunchApp(const std::string& app_id) override {
123 restart_called_++; 123 restart_called_++;
124 return true; 124 return true;
125 } 125 }
126 126
127 private: 127 private:
128 int unload_called_; 128 int unload_called_;
129 int restart_called_; 129 int restart_called_;
130 130
131 extensions::ExtensionSet extension_set_; 131 extensions::ExtensionSet extension_set_;
132 132
133 DISALLOW_COPY_AND_ASSIGN(TestExtensionsDelegate); 133 DISALLOW_COPY_AND_ASSIGN(TestExtensionsDelegate);
134 }; 134 };
135 135
136 } // namespace 136 } // namespace
137 137
138 // Our testing base. 138 // Our testing base.
139 class AppActivityTest : public AthenaTestBase { 139 class AppActivityTest : public AthenaTestBase {
140 public: 140 public:
141 AppActivityTest() : test_extensions_delegate_(NULL) {} 141 AppActivityTest() : test_extensions_delegate_(NULL) {}
142 virtual ~AppActivityTest() {} 142 virtual ~AppActivityTest() {}
143 143
144 // AthenaTestBase: 144 // AthenaTestBase:
145 virtual void SetUp() OVERRIDE { 145 virtual void SetUp() override {
146 AthenaTestBase::SetUp(); 146 AthenaTestBase::SetUp();
147 // Create and install our TestAppContentDelegate with instrumentation. 147 // Create and install our TestAppContentDelegate with instrumentation.
148 ExtensionsDelegate::Shutdown(); 148 ExtensionsDelegate::Shutdown();
149 // The instance will be deleted by ExtensionsDelegate::Shutdown(). 149 // The instance will be deleted by ExtensionsDelegate::Shutdown().
150 test_extensions_delegate_ = new TestExtensionsDelegate(); 150 test_extensions_delegate_ = new TestExtensionsDelegate();
151 } 151 }
152 152
153 // A function to create an Activity. 153 // A function to create an Activity.
154 TestAppActivity* CreateAppActivity(const std::string& app_id) { 154 TestAppActivity* CreateAppActivity(const std::string& app_id) {
155 TestAppActivity* activity = new TestAppActivity(app_id); 155 TestAppActivity* activity = new TestAppActivity(app_id);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // 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
427 // all objects should be still there.. 427 // all objects should be still there..
428 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications()); 428 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications());
429 EXPECT_TRUE(app_activity_registry->unloaded_activity_proxy()); 429 EXPECT_TRUE(app_activity_registry->unloaded_activity_proxy());
430 Activity::Delete(app_activity_registry->unloaded_activity_proxy()); 430 Activity::Delete(app_activity_registry->unloaded_activity_proxy());
431 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); 431 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications());
432 } 432 }
433 433
434 } // namespace test 434 } // namespace test
435 } // namespace athena 435 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/app_activity_proxy.h ('k') | athena/content/app_registry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698