Commit 828338e2 authored by oshima's avatar oshima Committed by Commit bot

rename WidnowManager::GetInstance -> ::Get

call OnTerminating in unit test.

BUG=None

Review URL: https://codereview.chromium.org/599683003

Cr-Commit-Position: refs/heads/master@{#296348}
parent 10c90275
...@@ -59,11 +59,11 @@ ActivityFrameView::ActivityFrameView(views::Widget* frame, ...@@ -59,11 +59,11 @@ ActivityFrameView::ActivityFrameView(views::Widget* frame,
UpdateWindowTitle(); UpdateWindowTitle();
UpdateWindowIcon(); UpdateWindowIcon();
WindowManager::GetInstance()->AddObserver(this); WindowManager::Get()->AddObserver(this);
} }
ActivityFrameView::~ActivityFrameView() { ActivityFrameView::~ActivityFrameView() {
WindowManager::GetInstance()->RemoveObserver(this); WindowManager::Get()->RemoveObserver(this);
} }
gfx::Rect ActivityFrameView::GetBoundsForClientView() const { gfx::Rect ActivityFrameView::GetBoundsForClientView() const {
......
...@@ -103,7 +103,7 @@ void AppActivity::Init() { ...@@ -103,7 +103,7 @@ void AppActivity::Init() {
// Note: At this time the |AppActivity| did not get registered to the // Note: At this time the |AppActivity| did not get registered to the
// |ResourceManager| - so we can move it around if needed. // |ResourceManager| - so we can move it around if needed.
WindowListProvider* window_list_provider = WindowListProvider* window_list_provider =
WindowManager::GetInstance()->GetWindowListProvider(); WindowManager::Get()->GetWindowListProvider();
window_list_provider->StackWindowFrontOf(app_proxy->GetWindow(), window_list_provider->StackWindowFrontOf(app_proxy->GetWindow(),
GetWindow()); GetWindow());
Activity::Delete(app_proxy); Activity::Delete(app_proxy);
......
...@@ -62,7 +62,7 @@ void AppActivityProxy::Init() { ...@@ -62,7 +62,7 @@ void AppActivityProxy::Init() {
// Get the content proxy to present the content. // Get the content proxy to present the content.
content_proxy_ = replaced_activity_->GetContentProxy(GetWindow()); content_proxy_ = replaced_activity_->GetContentProxy(GetWindow());
WindowListProvider* window_list_provider = WindowListProvider* window_list_provider =
WindowManager::GetInstance()->GetWindowListProvider(); WindowManager::Get()->GetWindowListProvider();
window_list_provider->StackWindowBehindTo(GetWindow(), window_list_provider->StackWindowBehindTo(GetWindow(),
replaced_activity_->GetWindow()); replaced_activity_->GetWindow());
// Creating this object was moving the activation to this window which should // Creating this object was moving the activation to this window which should
......
...@@ -119,7 +119,7 @@ void AppActivityRegistry::DelayedUnload() { ...@@ -119,7 +119,7 @@ void AppActivityRegistry::DelayedUnload() {
AppActivity* AppActivityRegistry::GetMruActivity() { AppActivity* AppActivityRegistry::GetMruActivity() {
DCHECK(activity_list_.size()); DCHECK(activity_list_.size());
WindowListProvider* window_list_provider = WindowListProvider* window_list_provider =
WindowManager::GetInstance()->GetWindowListProvider(); WindowManager::Get()->GetWindowListProvider();
const aura::Window::Windows& children = const aura::Window::Windows& children =
window_list_provider->GetWindowList(); window_list_provider->GetWindowList();
// Find the first window in the container which is part of the application. // Find the first window in the container which is part of the application.
......
...@@ -197,7 +197,7 @@ class HomeCardView : public views::WidgetDelegateView { ...@@ -197,7 +197,7 @@ class HomeCardView : public views::WidgetDelegateView {
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
if (HomeCard::Get()->GetState() == HomeCard::VISIBLE_MINIMIZED && if (HomeCard::Get()->GetState() == HomeCard::VISIBLE_MINIMIZED &&
event.IsLeftMouseButton() && event.GetClickCount() == 1) { event.IsLeftMouseButton() && event.GetClickCount() == 1) {
athena::WindowManager::GetInstance()->ToggleOverview(); athena::WindowManager::Get()->ToggleOverview();
return true; return true;
} }
return false; return false;
...@@ -232,12 +232,12 @@ HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) ...@@ -232,12 +232,12 @@ HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder)
activation_client_(NULL) { activation_client_(NULL) {
DCHECK(!instance); DCHECK(!instance);
instance = this; instance = this;
WindowManager::GetInstance()->AddObserver(this); WindowManager::Get()->AddObserver(this);
} }
HomeCardImpl::~HomeCardImpl() { HomeCardImpl::~HomeCardImpl() {
DCHECK(instance); DCHECK(instance);
WindowManager::GetInstance()->RemoveObserver(this); WindowManager::Get()->RemoveObserver(this);
if (activation_client_) if (activation_client_)
activation_client_->RemoveObserver(this); activation_client_->RemoveObserver(this);
home_card_widget_->CloseNow(); home_card_widget_->CloseNow();
...@@ -379,7 +379,7 @@ void HomeCardImpl::OnGestureEnded(State final_state, bool is_fling) { ...@@ -379,7 +379,7 @@ void HomeCardImpl::OnGestureEnded(State final_state, bool is_fling) {
if (state_ != final_state && if (state_ != final_state &&
(state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) { (state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) {
SetState(final_state); SetState(final_state);
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
} else { } else {
state_ = final_state; state_ = final_state;
// When the animation happens after a fling, EASE_IN_OUT would cause weird // When the animation happens after a fling, EASE_IN_OUT would cause weird
......
...@@ -48,13 +48,13 @@ TEST_F(HomeCardTest, BasicTransition) { ...@@ -48,13 +48,13 @@ TEST_F(HomeCardTest, BasicTransition) {
EXPECT_EQ(work_area_height, home_card->GetTargetBounds().y()); EXPECT_EQ(work_area_height, home_card->GetTargetBounds().y());
EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_NONE, wm::GetShadowType(home_card)); EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_NONE, wm::GetShadowType(home_card));
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_EQ(screen_height - kHomeCardHeight, home_card->GetTargetBounds().y()); EXPECT_EQ(screen_height - kHomeCardHeight, home_card->GetTargetBounds().y());
EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_RECTANGULAR, EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_RECTANGULAR,
wm::GetShadowType(home_card)); wm::GetShadowType(home_card));
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
EXPECT_EQ(work_area_height, home_card->GetTargetBounds().y()); EXPECT_EQ(work_area_height, home_card->GetTargetBounds().y());
EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_NONE, wm::GetShadowType(home_card)); EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_NONE, wm::GetShadowType(home_card));
...@@ -70,7 +70,7 @@ TEST_F(HomeCardTest, VirtualKeyboardTransition) { ...@@ -70,7 +70,7 @@ TEST_F(HomeCardTest, VirtualKeyboardTransition) {
EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
// bottom -> centered for virtual keyboard. // bottom -> centered for virtual keyboard.
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
HomeCard::Get()->UpdateVirtualKeyboardBounds(vk_bounds); HomeCard::Get()->UpdateVirtualKeyboardBounds(vk_bounds);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
...@@ -93,7 +93,7 @@ TEST_F(HomeCardTest, ToggleOverviewWithVirtualKeyboard) { ...@@ -93,7 +93,7 @@ TEST_F(HomeCardTest, ToggleOverviewWithVirtualKeyboard) {
// Toogle overview revives the bottom home card. Home card also gets // Toogle overview revives the bottom home card. Home card also gets
/// activated which will close the virtual keyboard. /// activated which will close the virtual keyboard.
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
aura::Window* home_card = GetHomeCardWindow(); aura::Window* home_card = GetHomeCardWindow();
EXPECT_TRUE(wm::IsActiveWindow(home_card)); EXPECT_TRUE(wm::IsActiveWindow(home_card));
...@@ -103,7 +103,7 @@ TEST_F(HomeCardTest, ToggleOverviewWithVirtualKeyboard) { ...@@ -103,7 +103,7 @@ TEST_F(HomeCardTest, ToggleOverviewWithVirtualKeyboard) {
TEST_F(HomeCardTest, AppSelection) { TEST_F(HomeCardTest, AppSelection) {
EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
athena::ActivityFactory::Get()->CreateWebActivity( athena::ActivityFactory::Get()->CreateWebActivity(
...@@ -122,7 +122,7 @@ TEST_F(HomeCardTest, Accelerators) { ...@@ -122,7 +122,7 @@ TEST_F(HomeCardTest, Accelerators) {
EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
// Do nothing for BOTTOM. // Do nothing for BOTTOM.
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
...@@ -146,12 +146,12 @@ TEST_F(HomeCardTest, MouseClick) { ...@@ -146,12 +146,12 @@ TEST_F(HomeCardTest, MouseClick) {
generator.ClickLeftButton(); generator.ClickLeftButton();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Further clicks are simply ignored. // Further clicks are simply ignored.
generator.ClickLeftButton(); generator.ClickLeftButton();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
} }
TEST_F(HomeCardTest, Gestures) { TEST_F(HomeCardTest, Gestures) {
...@@ -167,7 +167,7 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -167,7 +167,7 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Too short moves. Nothing has changed. // Too short moves. Nothing has changed.
generator.GestureScrollSequence(gfx::Point(x, bottom - 40), generator.GestureScrollSequence(gfx::Point(x, bottom - 40),
...@@ -175,14 +175,14 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -175,14 +175,14 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
generator.GestureScrollSequence(gfx::Point(x, bottom - 40), generator.GestureScrollSequence(gfx::Point(x, bottom - 40),
gfx::Point(x, bottom - 20), gfx::Point(x, bottom - 20),
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Swipe up to the centered state. // Swipe up to the centered state.
generator.GestureScrollSequence(gfx::Point(x, bottom - 40), generator.GestureScrollSequence(gfx::Point(x, bottom - 40),
...@@ -190,7 +190,7 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -190,7 +190,7 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Swipe up from centered; nothing has to be changed. // Swipe up from centered; nothing has to be changed.
generator.GestureScrollSequence(gfx::Point(x, bottom - 300), generator.GestureScrollSequence(gfx::Point(x, bottom - 300),
...@@ -198,7 +198,7 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -198,7 +198,7 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Swipe down slightly; nothing has to be changed. // Swipe down slightly; nothing has to be changed.
generator.GestureScrollSequence(gfx::Point(x, bottom - 300), generator.GestureScrollSequence(gfx::Point(x, bottom - 300),
...@@ -206,7 +206,7 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -206,7 +206,7 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Swipe down to the bottom state. // Swipe down to the bottom state.
generator.GestureScrollSequence(gfx::Point(x, 10), generator.GestureScrollSequence(gfx::Point(x, 10),
...@@ -214,14 +214,14 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -214,14 +214,14 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
generator.GestureScrollSequence(gfx::Point(x, bottom - 40), generator.GestureScrollSequence(gfx::Point(x, bottom - 40),
gfx::Point(x, bottom - 300), gfx::Point(x, bottom - 300),
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
// Swipe down to the minimized state. // Swipe down to the minimized state.
generator.GestureScrollSequence(gfx::Point(x, 10), generator.GestureScrollSequence(gfx::Point(x, 10),
...@@ -229,8 +229,7 @@ TEST_F(HomeCardTest, Gestures) { ...@@ -229,8 +229,7 @@ TEST_F(HomeCardTest, Gestures) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
EXPECT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive());
} }
TEST_F(HomeCardTest, GesturesToFullDirectly) { TEST_F(HomeCardTest, GesturesToFullDirectly) {
...@@ -246,7 +245,7 @@ TEST_F(HomeCardTest, GesturesToFullDirectly) { ...@@ -246,7 +245,7 @@ TEST_F(HomeCardTest, GesturesToFullDirectly) {
base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(1),
10); 10);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
} }
TEST_F(HomeCardTest, KeyboardFocus) { TEST_F(HomeCardTest, KeyboardFocus) {
...@@ -254,7 +253,7 @@ TEST_F(HomeCardTest, KeyboardFocus) { ...@@ -254,7 +253,7 @@ TEST_F(HomeCardTest, KeyboardFocus) {
aura::Window* home_card = GetHomeCardWindow(); aura::Window* home_card = GetHomeCardWindow();
ASSERT_FALSE(IsSearchBoxFocused(home_card)); ASSERT_FALSE(IsSearchBoxFocused(home_card));
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
ASSERT_FALSE(IsSearchBoxFocused(home_card)); ASSERT_FALSE(IsSearchBoxFocused(home_card));
ui::test::EventGenerator generator(root_window()); ui::test::EventGenerator generator(root_window());
......
...@@ -167,15 +167,15 @@ ResourceManagerImpl::ResourceManagerImpl(ResourceManagerDelegate* delegate) ...@@ -167,15 +167,15 @@ ResourceManagerImpl::ResourceManagerImpl(ResourceManagerDelegate* delegate)
next_resource_management_time_(base::Time::Now()), next_resource_management_time_(base::Time::Now()),
wait_time_for_resource_deallocation_(base::TimeDelta::FromMilliseconds( wait_time_for_resource_deallocation_(base::TimeDelta::FromMilliseconds(
delegate_->MemoryPressureIntervalInMS())) { delegate_->MemoryPressureIntervalInMS())) {
WindowManager::GetInstance()->AddObserver(this); WindowManager::Get()->AddObserver(this);
WindowManager::GetInstance()->GetWindowListProvider()->AddObserver(this); WindowManager::Get()->GetWindowListProvider()->AddObserver(this);
ActivityManager::Get()->AddObserver(this); ActivityManager::Get()->AddObserver(this);
} }
ResourceManagerImpl::~ResourceManagerImpl() { ResourceManagerImpl::~ResourceManagerImpl() {
ActivityManager::Get()->RemoveObserver(this); ActivityManager::Get()->RemoveObserver(this);
WindowManager::GetInstance()->GetWindowListProvider()->RemoveObserver(this); WindowManager::Get()->GetWindowListProvider()->RemoveObserver(this);
WindowManager::GetInstance()->RemoveObserver(this); WindowManager::Get()->RemoveObserver(this);
while (!activity_list_.empty()) while (!activity_list_.empty())
OnActivityEnding(activity_list_.front()); OnActivityEnding(activity_list_.front());
...@@ -418,7 +418,7 @@ void ResourceManagerImpl::UpdateActivityOrder() { ...@@ -418,7 +418,7 @@ void ResourceManagerImpl::UpdateActivityOrder() {
return; return;
std::vector<Activity*> new_activity_list; std::vector<Activity*> new_activity_list;
const aura::Window::Windows children = const aura::Window::Windows children =
activity_list_[0]->GetWindow()->parent()->children(); WindowManager::Get()->GetWindowListProvider()->GetWindowList();
// Find the first window in the container which is part of the application. // Find the first window in the container which is part of the application.
for (aura::Window::Windows::const_reverse_iterator child_iterator = for (aura::Window::Windows::const_reverse_iterator child_iterator =
children.rbegin(); children.rbegin();
......
...@@ -229,7 +229,7 @@ TEST_F(ResourceManagerTest, VisibilityChanges) { ...@@ -229,7 +229,7 @@ TEST_F(ResourceManagerTest, VisibilityChanges) {
// Once the split view mode gets turned on, more windows should become // Once the split view mode gets turned on, more windows should become
// visible. // visible.
WindowManager::GetInstance()->ToggleSplitViewForTest(); WindowManager::Get()->ToggleSplitViewForTest();
EXPECT_EQ(Activity::ACTIVITY_VISIBLE, app1->GetCurrentState()); EXPECT_EQ(Activity::ACTIVITY_VISIBLE, app1->GetCurrentState());
EXPECT_EQ(Activity::ACTIVITY_VISIBLE, app2->GetCurrentState()); EXPECT_EQ(Activity::ACTIVITY_VISIBLE, app2->GetCurrentState());
EXPECT_NE(Activity::ACTIVITY_VISIBLE, app3->GetCurrentState()); EXPECT_NE(Activity::ACTIVITY_VISIBLE, app3->GetCurrentState());
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "athena/test/athena_test_base.h" #include "athena/test/athena_test_base.h"
#include "athena/env/public/athena_env.h"
#include "athena/screen/public/screen_manager.h" #include "athena/screen/public/screen_manager.h"
#include "athena/test/athena_test_helper.h" #include "athena/test/athena_test_helper.h"
#include "ui/aura/client/window_tree_client.h" #include "ui/aura/client/window_tree_client.h"
...@@ -47,6 +48,8 @@ void AthenaTestBase::SetUp() { ...@@ -47,6 +48,8 @@ void AthenaTestBase::SetUp() {
} }
void AthenaTestBase::TearDown() { void AthenaTestBase::TearDown() {
AthenaEnv::Get()->OnTerminating();
teardown_called_ = true; teardown_called_ = true;
// Flush the message loop because we have pending release tasks // Flush the message loop because we have pending release tasks
......
...@@ -19,7 +19,7 @@ class ATHENA_EXPORT WindowManager { ...@@ -19,7 +19,7 @@ class ATHENA_EXPORT WindowManager {
// implementation. // implementation.
static WindowManager* Create(); static WindowManager* Create();
static void Shutdown(); static void Shutdown();
static WindowManager* GetInstance(); static WindowManager* Get();
virtual ~WindowManager() {} virtual ~WindowManager() {}
......
...@@ -10,7 +10,7 @@ namespace athena { ...@@ -10,7 +10,7 @@ namespace athena {
namespace test { namespace test {
WindowManagerImplTestApi::WindowManagerImplTestApi() WindowManagerImplTestApi::WindowManagerImplTestApi()
: wm_(static_cast<WindowManagerImpl*>(WindowManager::GetInstance())) { : wm_(static_cast<WindowManagerImpl*>(WindowManager::Get())) {
} }
WindowManagerImplTestApi::~WindowManagerImplTestApi() { WindowManagerImplTestApi::~WindowManagerImplTestApi() {
......
...@@ -426,7 +426,7 @@ void WindowManager::Shutdown() { ...@@ -426,7 +426,7 @@ void WindowManager::Shutdown() {
} }
// static // static
WindowManager* WindowManager::GetInstance() { WindowManager* WindowManager::Get() {
DCHECK(instance); DCHECK(instance);
return instance; return instance;
} }
......
...@@ -44,7 +44,7 @@ TEST_F(WindowManagerTest, OverviewModeBasics) { ...@@ -44,7 +44,7 @@ TEST_F(WindowManagerTest, OverviewModeBasics) {
test::WindowManagerImplTestApi wm_api; test::WindowManagerImplTestApi wm_api;
wm::ActivateWindow(second.get()); wm::ActivateWindow(second.get());
ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive());
EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString());
EXPECT_EQ(gfx::Screen::GetNativeScreen() EXPECT_EQ(gfx::Screen::GetNativeScreen()
->GetPrimaryDisplay() ->GetPrimaryDisplay()
...@@ -52,11 +52,11 @@ TEST_F(WindowManagerTest, OverviewModeBasics) { ...@@ -52,11 +52,11 @@ TEST_F(WindowManagerTest, OverviewModeBasics) {
.size() .size()
.ToString(), .ToString(),
first->bounds().size().ToString()); first->bounds().size().ToString());
EXPECT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive());
// Tests that going into overview mode does not change the window bounds. // Tests that going into overview mode does not change the window bounds.
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
ASSERT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); ASSERT_TRUE(WindowManager::Get()->IsOverviewModeActive());
EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString());
EXPECT_EQ(gfx::Screen::GetNativeScreen() EXPECT_EQ(gfx::Screen::GetNativeScreen()
->GetPrimaryDisplay() ->GetPrimaryDisplay()
...@@ -69,8 +69,8 @@ TEST_F(WindowManagerTest, OverviewModeBasics) { ...@@ -69,8 +69,8 @@ TEST_F(WindowManagerTest, OverviewModeBasics) {
// Terminate overview mode. |first| should be hidden, since it's not visible // Terminate overview mode. |first| should be hidden, since it's not visible
// to the user anymore. // to the user anymore.
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive());
EXPECT_FALSE(first->IsVisible()); EXPECT_FALSE(first->IsVisible());
EXPECT_TRUE(second->IsVisible()); EXPECT_TRUE(second->IsVisible());
} }
...@@ -84,7 +84,7 @@ TEST_F(WindowManagerTest, OverviewToSplitViewMode) { ...@@ -84,7 +84,7 @@ TEST_F(WindowManagerTest, OverviewToSplitViewMode) {
scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate)); scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate));
wm::ActivateWindow(w3.get()); wm::ActivateWindow(w3.get());
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_TRUE(w1->IsVisible()); EXPECT_TRUE(w1->IsVisible());
EXPECT_TRUE(w2->IsVisible()); EXPECT_TRUE(w2->IsVisible());
EXPECT_TRUE(w3->IsVisible()); EXPECT_TRUE(w3->IsVisible());
...@@ -102,7 +102,7 @@ TEST_F(WindowManagerTest, NewWindowFromOverview) { ...@@ -102,7 +102,7 @@ TEST_F(WindowManagerTest, NewWindowFromOverview) {
scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate)); scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate));
scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate)); scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate));
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_TRUE(w1->IsVisible()); EXPECT_TRUE(w1->IsVisible());
EXPECT_TRUE(w2->IsVisible()); EXPECT_TRUE(w2->IsVisible());
...@@ -110,7 +110,7 @@ TEST_F(WindowManagerTest, NewWindowFromOverview) { ...@@ -110,7 +110,7 @@ TEST_F(WindowManagerTest, NewWindowFromOverview) {
// have been opened by JavaScript or by the home card. // have been opened by JavaScript or by the home card.
scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate)); scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate));
ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive());
EXPECT_TRUE(w3->IsVisible()); EXPECT_TRUE(w3->IsVisible());
EXPECT_TRUE(wm::IsActiveWindow(w3.get())); EXPECT_TRUE(wm::IsActiveWindow(w3.get()));
EXPECT_FALSE(w1->IsVisible()); EXPECT_FALSE(w1->IsVisible());
...@@ -340,7 +340,7 @@ TEST_F(WindowManagerTest, OverviewModeFromSplitMode) { ...@@ -340,7 +340,7 @@ TEST_F(WindowManagerTest, OverviewModeFromSplitMode) {
// Get into split-view mode, and then turn on overview mode. // Get into split-view mode, and then turn on overview mode.
wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL); wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL);
WindowManager::GetInstance()->ToggleOverview(); WindowManager::Get()->ToggleOverview();
EXPECT_TRUE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); EXPECT_TRUE(wm_api.GetSplitViewController()->IsSplitViewModeActive());
EXPECT_EQ(w3.get(), wm_api.GetSplitViewController()->left_window()); EXPECT_EQ(w3.get(), wm_api.GetSplitViewController()->left_window());
EXPECT_EQ(w2.get(), wm_api.GetSplitViewController()->right_window()); EXPECT_EQ(w2.get(), wm_api.GetSplitViewController()->right_window());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment