#include "base/values.h"
#include "chrome/browser/chromeos/display/display_configuration_observer.h"
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
-#include "chrome/browser/chromeos/login/users/user_manager.h"
+#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
#include "ui/display/chromeos/display_configurator.h"
.WillRepeatedly(testing::Return(true));
EXPECT_CALL(*mock_user_manager_, IsLoggedInAsRegularUser())
.WillRepeatedly(testing::Return(false));
- EXPECT_CALL(*mock_user_manager_, IsLoggedInAsLocallyManagedUser())
+ EXPECT_CALL(*mock_user_manager_, IsLoggedInAsSupervisedUser())
.WillRepeatedly(testing::Return(false));
}
ash::DisplayManager* display_manager =
ash::Shell::GetInstance()->display_manager();
- UpdateDisplay("200x200*2, 400x300#400x400|300x200");
+ UpdateDisplay("200x200*2, 400x300#400x400|300x200*1.25");
int64 id1 = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id();
gfx::Display::SetInternalDisplayId(id1);
int64 id2 = ash::ScreenUtil::GetSecondaryDisplay().id();
EXPECT_FALSE(property->GetString("color_profile_name", &color_profile));
// Resolution is saved only when the resolution is set
- // by DisplayManager::SetDisplayResolution
+ // by DisplayManager::SetDisplayMode
width = 0;
height = 0;
EXPECT_FALSE(property->GetInteger("width", &width));
EXPECT_FALSE(property->GetInteger("height", &height));
- display_manager->SetDisplayResolution(id2, gfx::Size(300, 200));
+ ash::DisplayMode mode(gfx::Size(300, 200), 60.0f, false, true);
+ mode.device_scale_factor = 1.25f;
+ display_manager->SetDisplayMode(id2, mode);
display_controller->SetPrimaryDisplayId(id2);
// External display's resolution must be stored this time because
// it's not best.
+ int device_scale_factor = 0;
EXPECT_TRUE(properties->GetDictionary(base::Int64ToString(id2), &property));
EXPECT_TRUE(property->GetInteger("width", &width));
EXPECT_TRUE(property->GetInteger("height", &height));
+ EXPECT_TRUE(property->GetInteger(
+ "device-scale-factor", &device_scale_factor));
EXPECT_EQ(300, width);
EXPECT_EQ(200, height);
+ EXPECT_EQ(1250, device_scale_factor);
// The layout remains the same.
EXPECT_TRUE(displays->GetDictionary(key, &layout_value));
// Set new display's selected resolution.
display_manager->RegisterDisplayProperty(
- id2 + 1, gfx::Display::ROTATE_0, 1.0f, NULL, gfx::Size(500, 400),
+ id2 + 1, gfx::Display::ROTATE_0, 1.0f, NULL, gfx::Size(500, 400), 1.0f,
ui::COLOR_PROFILE_STANDARD);
UpdateDisplay("200x200*2, 600x500#600x500|500x400");
// Set yet another new display's selected resolution.
display_manager->RegisterDisplayProperty(
- id2 + 1, gfx::Display::ROTATE_0, 1.0f, NULL, gfx::Size(500, 400),
+ id2 + 1, gfx::Display::ROTATE_0, 1.0f, NULL, gfx::Size(500, 400), 1.0f,
ui::COLOR_PROFILE_STANDARD);
// Disconnect 2nd display first to generate new id for external display.
UpdateDisplay("200x200*2");
int64 id = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
// Set display's resolution in single display. It creates the notification and
// display preferences should not stored meanwhile.
- ash::Shell::GetInstance()->resolution_notification_controller()->
- SetDisplayResolutionAndNotify(
- id, gfx::Size(400, 300), gfx::Size(500, 400), base::Closure());
+ ash::Shell* shell = ash::Shell::GetInstance();
+ ash::DisplayMode old_mode;
+ ash::DisplayMode new_mode;
+ old_mode.size = gfx::Size(400, 300);
+ new_mode.size = gfx::Size(500, 400);
+ if (shell->display_manager()->SetDisplayMode(id, new_mode)) {
+ shell->resolution_notification_controller()->PrepareNotification(
+ id, old_mode, new_mode, base::Closure());
+ }
UpdateDisplay("500x400#500x400|400x300|300x200");
const base::DictionaryValue* properties =
ResolutionNotificationController::kNotificationId));
// Once the notification is removed, the specified resolution will be stored
- // by SetDisplayResolution.
- ash::Shell::GetInstance()->display_manager()->SetDisplayResolution(
- id, gfx::Size(300, 200));
+ // by SetDisplayMode.
+ ash::Shell::GetInstance()->display_manager()->SetDisplayMode(
+ id, ash::DisplayMode(gfx::Size(300, 200), 60.0f, false, true));
UpdateDisplay("300x200#500x400|400x300|300x200");
property = NULL;