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

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

Issue 694413005: athena: Introduce ActivityView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return activity; 153 return activity;
154 } 154 }
155 155
156 void DeleteActivity(Activity* activity) { 156 void DeleteActivity(Activity* activity) {
157 Activity::Delete(activity); 157 Activity::Delete(activity);
158 RunAllPendingInMessageLoop(); 158 RunAllPendingInMessageLoop();
159 } 159 }
160 160
161 // Get the position of the activity in the navigation history. 161 // Get the position of the activity in the navigation history.
162 int GetActivityPosition(Activity* activity) { 162 int GetActivityPosition(Activity* activity) {
163 aura::Window* window = activity->GetActivityViewModel()->GetContentsView() 163 aura::Window* window = activity->GetWindow();
164 ->GetWidget()->GetNativeWindow();
165 aura::Window::Windows windows = activity->GetWindow()->parent()->children(); 164 aura::Window::Windows windows = activity->GetWindow()->parent()->children();
oshima 2014/11/04 22:17:04 This will fail if there is a non activity window.
sadrul 2014/11/04 23:26:09 Oops. I meant to move this in a separate patch, si
166 for (size_t i = 0; i < windows.size(); i++) { 165 aura::Window::Windows::iterator iter =
167 if (windows[i] == window) 166 std::find(windows.begin(), windows.end(), window);
168 return i; 167 return iter == windows.end() ? -1 : iter - windows.begin();
169 }
170 return -1;
171 } 168 }
172 169
173 // To avoid interference of the ResourceManager in these AppActivity 170 // To avoid interference of the ResourceManager in these AppActivity
174 // framework tests, we disable the ResourceManager for some tests. 171 // framework tests, we disable the ResourceManager for some tests.
175 // Every use/interference of this function gets explained. 172 // Every use/interference of this function gets explained.
176 void DisableResourceManager() { 173 void DisableResourceManager() {
177 ResourceManager::Get()->Pause(true); 174 ResourceManager::Get()->Pause(true);
178 } 175 }
179 176
180 protected: 177 protected:
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // However - the restart in this test framework does not really restart and 419 // However - the restart in this test framework does not really restart and
423 // all objects should be still there.. 420 // all objects should be still there..
424 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications()); 421 EXPECT_EQ(1, AppRegistry::Get()->NumberOfApplications());
425 EXPECT_TRUE(app_activity_registry->unloaded_activity_proxy()); 422 EXPECT_TRUE(app_activity_registry->unloaded_activity_proxy());
426 Activity::Delete(app_activity_registry->unloaded_activity_proxy()); 423 Activity::Delete(app_activity_registry->unloaded_activity_proxy());
427 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications()); 424 EXPECT_EQ(0, AppRegistry::Get()->NumberOfApplications());
428 } 425 }
429 426
430 } // namespace test 427 } // namespace test
431 } // namespace athena 428 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698