OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace { | 21 namespace { |
22 | 22 |
23 class DisplayPreferencesTest : public ash::test::AshTestBase { | 23 class DisplayPreferencesTest : public ash::test::AshTestBase { |
24 protected: | 24 protected: |
25 DisplayPreferencesTest() : ash::test::AshTestBase() {} | 25 DisplayPreferencesTest() : ash::test::AshTestBase() {} |
26 virtual ~DisplayPreferencesTest() {} | 26 virtual ~DisplayPreferencesTest() {} |
27 | 27 |
28 virtual void SetUp() OVERRIDE { | 28 virtual void SetUp() OVERRIDE { |
29 ash::test::AshTestBase::SetUp(); | 29 ash::test::AshTestBase::SetUp(); |
30 RegisterDisplayLocalStatePrefs(&local_state_); | 30 RegisterDisplayLocalStatePrefs(&local_state_); |
31 TestingBrowserProcess* browser_process = | 31 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
32 static_cast<TestingBrowserProcess*>(g_browser_process); | |
33 browser_process->SetLocalState(&local_state_); | |
34 } | 32 } |
35 | 33 |
36 virtual void TearDown() OVERRIDE { | 34 virtual void TearDown() OVERRIDE { |
37 TestingBrowserProcess* browser_process = | 35 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
38 static_cast<TestingBrowserProcess*>(g_browser_process); | |
39 browser_process->SetLocalState(NULL); | |
40 ash::test::AshTestBase::TearDown(); | 36 ash::test::AshTestBase::TearDown(); |
41 } | 37 } |
42 | 38 |
43 void LoggedInAsUser() { | 39 void LoggedInAsUser() { |
44 EXPECT_CALL(*mock_user_manager_.user_manager(), IsUserLoggedIn()) | 40 EXPECT_CALL(*mock_user_manager_.user_manager(), IsUserLoggedIn()) |
45 .WillRepeatedly(testing::Return(true)); | 41 .WillRepeatedly(testing::Return(true)); |
46 EXPECT_CALL(*mock_user_manager_.user_manager(), IsLoggedInAsDemoUser()) | 42 EXPECT_CALL(*mock_user_manager_.user_manager(), IsLoggedInAsDemoUser()) |
47 .WillRepeatedly(testing::Return(false)); | 43 .WillRepeatedly(testing::Return(false)); |
48 EXPECT_CALL(*mock_user_manager_.user_manager(), IsLoggedInAsGuest()) | 44 EXPECT_CALL(*mock_user_manager_.user_manager(), IsLoggedInAsGuest()) |
49 .WillRepeatedly(testing::Return(false)); | 45 .WillRepeatedly(testing::Return(false)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); | 222 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); |
227 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); | 223 EXPECT_EQ(id2, screen->GetPrimaryDisplay().id()); |
228 EXPECT_EQ(ash::DisplayLayout::BOTTOM, | 224 EXPECT_EQ(ash::DisplayLayout::BOTTOM, |
229 display_controller->GetCurrentDisplayLayout().position); | 225 display_controller->GetCurrentDisplayLayout().position); |
230 EXPECT_EQ(-10, display_controller->GetCurrentDisplayLayout().offset); | 226 EXPECT_EQ(-10, display_controller->GetCurrentDisplayLayout().offset); |
231 EXPECT_EQ("176x178", screen->GetPrimaryDisplay().bounds().size().ToString()); | 227 EXPECT_EQ("176x178", screen->GetPrimaryDisplay().bounds().size().ToString()); |
232 } | 228 } |
233 | 229 |
234 } // namespace | 230 } // namespace |
235 } // namespace chromeos | 231 } // namespace chromeos |
OLD | NEW |