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

Side by Side Diff: ash/wm/ash_native_cursor_manager_interactive_uitest.cc

Issue 2400553002: ash: Remove broken display notification suppression when settings is open (Closed)
Patch Set: fix tests Created 4 years, 2 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/test/test_system_tray_delegate.cc ('k') | chrome/browser/ui/ash/system_tray_client.h » ('j') | 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 #include "ash/wm/ash_native_cursor_manager.h" 5 #include "ash/wm/ash_native_cursor_manager.h"
5 6
6 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
7 #include "ash/shell.h" 8 #include "ash/shell.h"
8 #include "ash/test/ash_interactive_ui_test_base.h" 9 #include "ash/test/ash_interactive_ui_test_base.h"
9 #include "ash/test/cursor_manager_test_api.h" 10 #include "ash/test/cursor_manager_test_api.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
12 #include "ui/aura/window_tree_host.h" 13 #include "ui/aura/window_tree_host.h"
13 #include "ui/base/test/ui_controls.h" 14 #include "ui/base/test/ui_controls.h"
14 #include "ui/display/manager/managed_display_info.h" 15 #include "ui/display/manager/managed_display_info.h"
15 16
17 #if defined(OS_CHROMEOS)
18 #include "ash/system/chromeos/screen_layout_observer.h"
19 #endif
20
16 #if defined(USE_X11) 21 #if defined(USE_X11)
17 #include <X11/Xlib.h> 22 #include <X11/Xlib.h>
18 23
19 #include "ui/gfx/x/x11_types.h" 24 #include "ui/gfx/x/x11_types.h"
20 #endif 25 #endif
21 26
22 namespace ash { 27 namespace ash {
23 28
24 using AshNativeCursorManagerTest = test::AshInteractiveUITestBase; 29 using AshNativeCursorManagerTest = test::AshInteractiveUITestBase;
25 30
26 namespace { 31 namespace {
27 32
33 #if defined(OS_CHROMEOS)
34 class ScopedSuppressNotifications {
35 public:
36 ScopedSuppressNotifications() {
37 ScreenLayoutObserver::SuppressNotificationsForTesting(true);
38 }
39 ~ScopedSuppressNotifications() {
40 ScreenLayoutObserver::SuppressNotificationsForTesting(false);
41 }
42
43 private:
44 DISALLOW_COPY_AND_ASSIGN(ScopedSuppressNotifications);
45 };
46 #endif // defined(OS_CHROMEOS)
47
28 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, 48 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id,
29 const gfx::Rect& bounds, 49 const gfx::Rect& bounds,
30 float device_scale_factor) { 50 float device_scale_factor) {
31 display::ManagedDisplayInfo info(id, "", false); 51 display::ManagedDisplayInfo info(id, "", false);
32 info.SetBounds(bounds); 52 info.SetBounds(bounds);
33 info.set_device_scale_factor(device_scale_factor); 53 info.set_device_scale_factor(device_scale_factor);
34 return info; 54 return info;
35 } 55 }
36 56
37 void MoveMouseSync(aura::Window* window, int x, int y) { 57 void MoveMouseSync(aura::Window* window, int x, int y) {
(...skipping 11 matching lines...) Expand all
49 69
50 } // namespace 70 } // namespace
51 71
52 #if defined(USE_X11) 72 #if defined(USE_X11)
53 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify 73 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify
54 #else 74 #else
55 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify 75 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify
56 #endif 76 #endif
57 77
58 TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) { 78 TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) {
79 #if defined(OS_CHROMEOS)
80 // Showing notifications causes crashes in Skia due to discardable memory
81 // allocator problems. It's not clear why.
82 ScopedSuppressNotifications suppress_notifications;
oshima 2016/10/11 17:19:00 can you file a bug with a stack?
James Cook 2016/10/11 18:01:04 Added link to bug.
83 #endif
84
59 ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); 85 ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
60 test::CursorManagerTestApi test_api(cursor_manager); 86 test::CursorManagerTestApi test_api(cursor_manager);
61 87
62 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 88 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
63 display::ManagedDisplayInfo display_info1 = 89 display::ManagedDisplayInfo display_info1 =
64 CreateDisplayInfo(10, gfx::Rect(0, 0, 500, 300), 1.0f); 90 CreateDisplayInfo(10, gfx::Rect(0, 0, 500, 300), 1.0f);
65 display::ManagedDisplayInfo display_info2 = 91 display::ManagedDisplayInfo display_info2 =
66 CreateDisplayInfo(20, gfx::Rect(500, 0, 500, 300), 2.0f); 92 CreateDisplayInfo(20, gfx::Rect(500, 0, 500, 300), 2.0f);
67 std::vector<display::ManagedDisplayInfo> display_info_list; 93 std::vector<display::ManagedDisplayInfo> display_info_list;
68 display_info_list.push_back(display_info1); 94 display_info_list.push_back(display_info1);
69 display_info_list.push_back(display_info2); 95 display_info_list.push_back(display_info2);
70 display_manager->OnNativeDisplaysChanged(display_info_list); 96 display_manager->OnNativeDisplaysChanged(display_info_list);
71 97
72 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); 98 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10);
73 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); 99 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor());
74 100
75 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); 101 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10);
76 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); 102 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor());
77 } 103 }
78 104
79 } // namespace ash 105 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/test_system_tray_delegate.cc ('k') | chrome/browser/ui/ash/system_tray_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698