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

Side by Side Diff: ash/common/metrics/pointer_metrics_recorder_unittest.cc

Issue 2726823003: Remove WmLookup. (Closed)
Patch Set: Clean up include and modify comment. 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/metrics/pointer_metrics_recorder.h" 5 #include "ash/common/metrics/pointer_metrics_recorder.h"
6 6
7 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 7 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
8 #include "ash/common/wm_lookup.h"
9 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
11 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
12 #include "ash/shared/app_types.h" 11 #include "ash/shared/app_types.h"
13 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
14 #include "base/test/histogram_tester.h" 13 #include "base/test/histogram_tester.h"
15 #include "ui/events/event.h" 14 #include "ui/events/event.h"
16 #include "ui/views/pointer_watcher.h" 15 #include "ui/views/pointer_watcher.h"
17 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
18 17
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 151
153 // Verifies that down events dispatched to different destinations are recorded. 152 // Verifies that down events dispatched to different destinations are recorded.
154 TEST_F(PointerMetricsRecorderTest, DownEventPerDestination) { 153 TEST_F(PointerMetricsRecorderTest, DownEventPerDestination) {
155 std::unique_ptr<views::Widget> target = 154 std::unique_ptr<views::Widget> target =
156 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 155 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
157 const ui::PointerEvent pointer_event( 156 const ui::PointerEvent pointer_event(
158 ui::ET_POINTER_DOWN, gfx::Point(), gfx::Point(), 0, 0, 0, 157 ui::ET_POINTER_DOWN, gfx::Point(), gfx::Point(), 0, 0, 0,
159 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE), 158 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE),
160 base::TimeTicks()); 159 base::TimeTicks());
161 160
162 WmWindow* window = WmLookup::Get()->GetWindowForWidget(target.get()); 161 WmWindow* window = WmWindow::Get(target->GetNativeWindow());
163 CHECK(window); 162 CHECK(window);
164 163
165 window->SetAppType(static_cast<int>(AppType::OTHERS)); 164 window->SetAppType(static_cast<int>(AppType::OTHERS));
166 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(), 165 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
167 target.get()); 166 target.get());
168 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 0, 1); 167 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 0, 1);
169 168
170 window->SetAppType(static_cast<int>(AppType::BROWSER)); 169 window->SetAppType(static_cast<int>(AppType::BROWSER));
171 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(), 170 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
172 target.get()); 171 target.get());
173 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 1, 1); 172 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 1, 1);
174 173
175 window->SetAppType(static_cast<int>(AppType::CHROME_APP)); 174 window->SetAppType(static_cast<int>(AppType::CHROME_APP));
176 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(), 175 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
177 target.get()); 176 target.get());
178 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 2, 1); 177 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 2, 1);
179 178
180 window->SetAppType(static_cast<int>(AppType::ARC_APP)); 179 window->SetAppType(static_cast<int>(AppType::ARC_APP));
181 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(), 180 pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
182 target.get()); 181 target.get());
183 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 3, 1); 182 histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 3, 1);
184 } 183 }
185 184
186 } // namespace ash 185 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/metrics/pointer_metrics_recorder.cc ('k') | ash/common/shelf/overflow_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698