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

Side by Side Diff: ash/system/chromeos/screen_layout_observer_unittest.cc

Issue 2714543003: Remove docked-mode notification (Closed)
Patch Set: Created 3 years, 10 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 | « ash/system/chromeos/screen_layout_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/system/chromeos/screen_layout_observer.h" 5 #include "ash/system/chromeos/screen_layout_observer.h"
6 6
7 #include "ash/common/system/chromeos/devicetype_utils.h" 7 #include "ash/common/system/chromeos/devicetype_utils.h"
8 #include "ash/common/system/tray/system_tray.h" 8 #include "ash/common/system/tray/system_tray.h"
9 #include "ash/common/test/test_system_tray_delegate.h" 9 #include "ash/common/test/test_system_tray_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 l10n_util::GetStringUTF16( 194 l10n_util::GetStringUTF16(
195 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)), 195 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
196 GetDisplayNotificationAdditionalText()); 196 GetDisplayNotificationAdditionalText());
197 EXPECT_TRUE(GetDisplayNotificationText().empty()); 197 EXPECT_TRUE(GetDisplayNotificationText().empty());
198 198
199 // Enters closed lid mode. 199 // Enters closed lid mode.
200 UpdateDisplay("400x400@1.5,200x200"); 200 UpdateDisplay("400x400@1.5,200x200");
201 display::Display::SetInternalDisplayId( 201 display::Display::SetInternalDisplayId(
202 display_manager()->GetSecondaryDisplay().id()); 202 display_manager()->GetSecondaryDisplay().id());
203 UpdateDisplay("400x400@1.5"); 203 UpdateDisplay("400x400@1.5");
204 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED), 204 EXPECT_TRUE(GetDisplayNotificationText().empty());
205 GetDisplayNotificationText());
206 EXPECT_EQ(ash::SubstituteChromeOSDeviceType(
207 IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION),
208 GetDisplayNotificationAdditionalText());
209 } 205 }
210 206
211 // Verify that notification shows up when display is switched from dock mode to 207 // Verify that notification shows up when display is switched from dock mode to
212 // extend mode. 208 // extend mode.
213 TEST_F(ScreenLayoutObserverTest, DisplayConfigurationChangedTwice) { 209 TEST_F(ScreenLayoutObserverTest, DisplayConfigurationChangedTwice) {
214 Shell::GetInstance() 210 Shell::GetInstance()
215 ->screen_layout_observer() 211 ->screen_layout_observer()
216 ->set_show_notifications_for_testing(true); 212 ->set_show_notifications_for_testing(true);
217 UpdateDisplay("400x400,200x200"); 213 UpdateDisplay("400x400,200x200");
218 EXPECT_EQ(l10n_util::GetStringUTF16( 214 EXPECT_EQ(l10n_util::GetStringUTF16(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 EXPECT_TRUE(GetDisplayNotificationText().empty()); 263 EXPECT_TRUE(GetDisplayNotificationText().empty());
268 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); 264 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
269 265
270 // Reset the overscan. 266 // Reset the overscan.
271 Shell::GetInstance()->display_manager()->SetOverscanInsets( 267 Shell::GetInstance()->display_manager()->SetOverscanInsets(
272 display_manager()->GetSecondaryDisplay().id(), gfx::Insets()); 268 display_manager()->GetSecondaryDisplay().id(), gfx::Insets());
273 EXPECT_TRUE(GetDisplayNotificationText().empty()); 269 EXPECT_TRUE(GetDisplayNotificationText().empty());
274 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); 270 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
275 } 271 }
276 272
277 // Tests that exiting mirror mode by closing the lid shows the correct "docked 273 // Tests that exiting mirror mode by closing the lid shows the correct "exiting
278 // mode" message. 274 // mirror mode" message.
279 TEST_F(ScreenLayoutObserverTest, ExitMirrorModeBecauseOfDockedModeMessage) { 275 TEST_F(ScreenLayoutObserverTest, ExitMirrorModeBecauseOfDockedModeMessage) {
280 Shell::GetInstance() 276 Shell::GetInstance()
281 ->screen_layout_observer() 277 ->screen_layout_observer()
282 ->set_show_notifications_for_testing(true); 278 ->set_show_notifications_for_testing(true);
283 UpdateDisplay("400x400,200x200"); 279 UpdateDisplay("400x400,200x200");
284 display::Display::SetInternalDisplayId( 280 display::Display::SetInternalDisplayId(
285 display_manager()->GetSecondaryDisplay().id()); 281 display_manager()->GetSecondaryDisplay().id());
286 282
287 // Mirroring. 283 // Mirroring.
288 display_manager()->SetSoftwareMirroring(true); 284 display_manager()->SetSoftwareMirroring(true);
289 UpdateDisplay("400x400,200x200"); 285 UpdateDisplay("400x400,200x200");
290 EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, 286 EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING,
291 GetMirroringDisplayName()), 287 GetMirroringDisplayName()),
292 GetDisplayNotificationText()); 288 GetDisplayNotificationText());
293 289
294 // Docked. 290 // Docked.
295 CloseNotification(); 291 CloseNotification();
296 display_manager()->SetSoftwareMirroring(false); 292 display_manager()->SetSoftwareMirroring(false);
297 display::Display::SetInternalDisplayId(display_manager()->first_display_id()); 293 display::Display::SetInternalDisplayId(display_manager()->first_display_id());
298 UpdateDisplay("200x200"); 294 UpdateDisplay("200x200");
299 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED), 295 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRROR_EXIT),
300 GetDisplayNotificationText()); 296 GetDisplayNotificationText());
301 EXPECT_EQ(ash::SubstituteChromeOSDeviceType(
302 IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION),
303 GetDisplayNotificationAdditionalText());
304 } 297 }
305 298
306 // Tests that exiting mirror mode because of adding a third display shows the 299 // Tests that exiting mirror mode because of adding a third display shows the
307 // correct "3+ displays mirror mode is not supported" message. 300 // correct "3+ displays mirror mode is not supported" message.
308 TEST_F(ScreenLayoutObserverTest, ExitMirrorModeBecauseOfThirdDisplayMessage) { 301 TEST_F(ScreenLayoutObserverTest, ExitMirrorModeBecauseOfThirdDisplayMessage) {
309 Shell::GetInstance() 302 Shell::GetInstance()
310 ->screen_layout_observer() 303 ->screen_layout_observer()
311 ->set_show_notifications_for_testing(true); 304 ->set_show_notifications_for_testing(true);
312 UpdateDisplay("400x400,200x200"); 305 UpdateDisplay("400x400,200x200");
313 display::Display::SetInternalDisplayId( 306 display::Display::SetInternalDisplayId(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 427
435 const int64_t primary_id = display_manager()->GetDisplayAt(0).id(); 428 const int64_t primary_id = display_manager()->GetDisplayAt(0).id();
436 const int64_t internal_secondary_id = display_manager()->GetDisplayAt(1).id(); 429 const int64_t internal_secondary_id = display_manager()->GetDisplayAt(1).id();
437 display::Display::SetInternalDisplayId(internal_secondary_id); 430 display::Display::SetInternalDisplayId(internal_secondary_id);
438 display::DisplayLayoutBuilder builder(primary_id); 431 display::DisplayLayoutBuilder builder(primary_id);
439 builder.AddDisplayPlacement(internal_secondary_id, primary_id, 432 builder.AddDisplayPlacement(internal_secondary_id, primary_id,
440 display::DisplayPlacement::LEFT, 0); 433 display::DisplayPlacement::LEFT, 0);
441 display_manager()->SetLayoutForCurrentDisplays(builder.Build()); 434 display_manager()->SetLayoutForCurrentDisplays(builder.Build());
442 EXPECT_TRUE(GetDisplayNotificationText().empty()); 435 EXPECT_TRUE(GetDisplayNotificationText().empty());
443 436
444 // Close the lid and expect we show the docked mode message. 437 // Close the lid. We go to docked mode, but we show no notifications.
445 UpdateDisplay("400x400"); 438 UpdateDisplay("400x400");
446 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED), 439 EXPECT_TRUE(GetDisplayNotificationText().empty());
447 GetDisplayNotificationText()); 440 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
448 EXPECT_EQ(ash::SubstituteChromeOSDeviceType(
449 IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION),
450 GetDisplayNotificationAdditionalText());
451 } 441 }
452 442
453 } // namespace ash 443 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/screen_layout_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698