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

Side by Side Diff: ash/metrics/desktop_task_switch_metric_recorder_unittest.cc

Issue 2718763003: chromeos: makes more tests run in both mash and ash (Closed)
Patch Set: disable more ShelfViewTests Created 3 years, 9 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/BUILD.gn ('k') | ash/metrics/user_metrics_recorder_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/metrics/desktop_task_switch_metric_recorder.h" 5 #include "ash/metrics/desktop_task_switch_metric_recorder.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
11 #include "base/test/user_action_tester.h" 12 #include "base/test/user_action_tester.h"
12 #include "ui/aura/test/test_window_delegate.h" 13 #include "ui/aura/test/test_window_delegate.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/compositor/layer_type.h" 15 #include "ui/compositor/layer_type.h"
15 #include "ui/events/test/event_generator.h" 16 #include "ui/events/test/event_generator.h"
16 #include "ui/wm/public/activation_client.h" 17 #include "ui/wm/public/activation_client.h"
17 #include "ui/wm/public/window_types.h" 18 #include "ui/wm/public/window_types.h"
18 19
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate())); 113 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate()));
113 window->SetType(ui::wm::WINDOW_TYPE_UNKNOWN); 114 window->SetType(ui::wm::WINDOW_TYPE_UNKNOWN);
114 window->Init(ui::LAYER_NOT_DRAWN); 115 window->Init(ui::LAYER_NOT_DRAWN);
115 return window; 116 return window;
116 } 117 }
117 118
118 // Verify user action is recorded when a positionable window is activated given 119 // Verify user action is recorded when a positionable window is activated given
119 // that a null window was activated last. 120 // that a null window was activated last.
120 TEST_F(DesktopTaskSwitchMetricRecorderTest, 121 TEST_F(DesktopTaskSwitchMetricRecorderTest,
121 ActivatePositionableWindowWhenNullWindowWasActivatedLast) { 122 ActivatePositionableWindowWhenNullWindowWasActivatedLast) {
123 // TODO: investigate failure in mash, http://crbug.com/695628.
124 if (WmShell::Get()->IsRunningInMash())
125 return;
126
122 std::unique_ptr<aura::Window> null_window; 127 std::unique_ptr<aura::Window> null_window;
123 std::unique_ptr<aura::Window> positionable_window = 128 std::unique_ptr<aura::Window> positionable_window =
124 CreatePositionableWindow(); 129 CreatePositionableWindow();
125 130
126 ActiveTaskWindowWithUserInput(null_window.get()); 131 ActiveTaskWindowWithUserInput(null_window.get());
127 ResetActionCounts(); 132 ResetActionCounts();
128 133
129 ActiveTaskWindowWithUserInput(positionable_window.get()); 134 ActiveTaskWindowWithUserInput(positionable_window.get());
130 EXPECT_EQ(1, GetActionCount()); 135 EXPECT_EQ(1, GetActionCount());
131 } 136 }
132 137
133 // Verify user action is recorded whena positionable window is activated given 138 // Verify user action is recorded whena positionable window is activated given
134 // a different positionable window was activated last. 139 // a different positionable window was activated last.
135 TEST_F( 140 TEST_F(
136 DesktopTaskSwitchMetricRecorderTest, 141 DesktopTaskSwitchMetricRecorderTest,
137 ActivatePositionableWindowWhenADifferentPositionableWindowWasActivatedLast) { 142 ActivatePositionableWindowWhenADifferentPositionableWindowWasActivatedLast) {
143 // TODO: investigate failure in mash, http://crbug.com/695628.
144 if (WmShell::Get()->IsRunningInMash())
145 return;
146
138 std::unique_ptr<aura::Window> positionable_window_1 = 147 std::unique_ptr<aura::Window> positionable_window_1 =
139 CreatePositionableWindow(); 148 CreatePositionableWindow();
140 std::unique_ptr<aura::Window> positionable_window_2 = 149 std::unique_ptr<aura::Window> positionable_window_2 =
141 CreatePositionableWindow(); 150 CreatePositionableWindow();
142 151
143 ActiveTaskWindowWithUserInput(positionable_window_1.get()); 152 ActiveTaskWindowWithUserInput(positionable_window_1.get());
144 ResetActionCounts(); 153 ResetActionCounts();
145 154
146 ActiveTaskWindowWithUserInput(positionable_window_2.get()); 155 ActiveTaskWindowWithUserInput(positionable_window_2.get());
147 EXPECT_EQ(1, GetActionCount()); 156 EXPECT_EQ(1, GetActionCount());
(...skipping 11 matching lines...) Expand all
159 ResetActionCounts(); 168 ResetActionCounts();
160 169
161 ActiveTaskWindowWithUserInput(positionable_window.get()); 170 ActiveTaskWindowWithUserInput(positionable_window.get());
162 EXPECT_EQ(0, GetActionCount()); 171 EXPECT_EQ(0, GetActionCount());
163 } 172 }
164 173
165 // Verify user action is recorded when a positionable window is activated given 174 // Verify user action is recorded when a positionable window is activated given
166 // a non-positionable window was activated last. 175 // a non-positionable window was activated last.
167 TEST_F(DesktopTaskSwitchMetricRecorderTest, 176 TEST_F(DesktopTaskSwitchMetricRecorderTest,
168 ActivatePositionableWindowWhenANonPositionableWindowWasActivatedLast) { 177 ActivatePositionableWindowWhenANonPositionableWindowWasActivatedLast) {
178 // TODO: investigate failure in mash, http://crbug.com/695628.
179 if (WmShell::Get()->IsRunningInMash())
180 return;
181
169 std::unique_ptr<aura::Window> non_positionable_window = 182 std::unique_ptr<aura::Window> non_positionable_window =
170 CreateNonPositionableWindow(); 183 CreateNonPositionableWindow();
171 std::unique_ptr<aura::Window> positionable_window = 184 std::unique_ptr<aura::Window> positionable_window =
172 CreatePositionableWindow(); 185 CreatePositionableWindow();
173 186
174 ActiveTaskWindowWithUserInput(non_positionable_window.get()); 187 ActiveTaskWindowWithUserInput(non_positionable_window.get());
175 ResetActionCounts(); 188 ResetActionCounts();
176 189
177 ActiveTaskWindowWithUserInput(positionable_window.get()); 190 ActiveTaskWindowWithUserInput(positionable_window.get());
178 EXPECT_EQ(1, GetActionCount()); 191 EXPECT_EQ(1, GetActionCount());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 313
301 aura::Window* DesktopTaskSwitchMetricRecorderWithShellIntegrationTest:: 314 aura::Window* DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::
302 CreatePositionableWindowInShellWithBounds(const gfx::Rect& bounds) { 315 CreatePositionableWindowInShellWithBounds(const gfx::Rect& bounds) {
303 return CreateTestWindowInShellWithDelegate(&test_window_delegate_, 0, bounds); 316 return CreateTestWindowInShellWithDelegate(&test_window_delegate_, 0, bounds);
304 } 317 }
305 318
306 // Verify a user action is recorded when a positionable window is activated by 319 // Verify a user action is recorded when a positionable window is activated by
307 // a INPUT_EVENT. 320 // a INPUT_EVENT.
308 TEST_F(DesktopTaskSwitchMetricRecorderWithShellIntegrationTest, 321 TEST_F(DesktopTaskSwitchMetricRecorderWithShellIntegrationTest,
309 ActivatePositionableWindowWithInputEvent) { 322 ActivatePositionableWindowWithInputEvent) {
323 // TODO: investigate failure in mash, http://crbug.com/695628.
324 if (WmShell::Get()->IsRunningInMash())
325 return;
310 aura::Window* positionable_window = 326 aura::Window* positionable_window =
311 CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10)); 327 CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10));
312 328
313 ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow()); 329 ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow());
314 330
315 event_generator.MoveMouseToCenterOf(positionable_window); 331 event_generator.MoveMouseToCenterOf(positionable_window);
316 event_generator.ClickLeftButton(); 332 event_generator.ClickLeftButton();
317 333
318 EXPECT_EQ(1, GetActionCount()); 334 EXPECT_EQ(1, GetActionCount());
319 } 335 }
320 336
321 // Verify a user action is not recorded when a positionable window is activated 337 // Verify a user action is not recorded when a positionable window is activated
322 // by a non INPUT_EVENT. 338 // by a non INPUT_EVENT.
323 TEST_F(DesktopTaskSwitchMetricRecorderWithShellIntegrationTest, 339 TEST_F(DesktopTaskSwitchMetricRecorderWithShellIntegrationTest,
324 ActivatePositionableWindowWithNonInputEvent) { 340 ActivatePositionableWindowWithNonInputEvent) {
325 aura::Window* positionable_window = 341 aura::Window* positionable_window =
326 CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10)); 342 CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10));
327 343
328 Shell::GetInstance()->activation_client()->ActivateWindow( 344 Shell::GetInstance()->activation_client()->ActivateWindow(
329 positionable_window); 345 positionable_window);
330 346
331 EXPECT_EQ(0, GetActionCount()); 347 EXPECT_EQ(0, GetActionCount());
332 } 348 }
333 349
334 } // namespace 350 } // namespace
335 } // namespace ash 351 } // namespace ash
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/metrics/user_metrics_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698