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

Side by Side Diff: chrome/browser/chromeos/policy/status_uploader_unittest.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/chromeos/policy/status_uploader.h" 5 #include "chrome/browser/chromeos/policy/status_uploader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 #if defined(USE_X11) 248 #if defined(USE_X11)
249 ui::ScopedXI2Event native_event; 249 ui::ScopedXI2Event native_event;
250 const int kPointerDeviceId = 10; 250 const int kPointerDeviceId = 10;
251 std::vector<int> device_list; 251 std::vector<int> device_list;
252 device_list.push_back(kPointerDeviceId); 252 device_list.push_back(kPointerDeviceId);
253 ui::TouchFactory::GetInstance()->SetPointerDeviceForTest(device_list); 253 ui::TouchFactory::GetInstance()->SetPointerDeviceForTest(device_list);
254 native_event.InitGenericButtonEvent( 254 native_event.InitGenericButtonEvent(
255 kPointerDeviceId, ui::ET_MOUSE_PRESSED, gfx::Point(), 255 kPointerDeviceId, ui::ET_MOUSE_PRESSED, gfx::Point(),
256 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_CONTROL_DOWN); 256 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_CONTROL_DOWN);
257 #elif defined(USE_OZONE) 257 #elif defined(USE_OZONE)
258 ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 258 ui::MouseEvent e(
259 ui::EventTimeForNow(), 0, 0); 259 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
260 0, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
260 const ui::PlatformEvent& native_event = &e; 261 const ui::PlatformEvent& native_event = &e;
261 #endif 262 #endif
262 ui::UserActivityDetector::Get()->DidProcessEvent(native_event); 263 ui::UserActivityDetector::Get()->DidProcessEvent(native_event);
263 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed()); 264 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed());
264 } 265 }
265 #endif 266 #endif
266 267
267 TEST_F(StatusUploaderTest, NoUploadAfterVideoCapture) { 268 TEST_F(StatusUploaderTest, NoUploadAfterVideoCapture) {
268 StatusUploader uploader(&client_, std::move(collector_), task_runner_); 269 StatusUploader uploader(&client_, std::move(collector_), task_runner_);
269 // Should allow data upload before there is video capture. 270 // Should allow data upload before there is video capture.
270 EXPECT_TRUE(uploader.IsSessionDataUploadAllowed()); 271 EXPECT_TRUE(uploader.IsSessionDataUploadAllowed());
271 272
272 // Now mock video capture, and no session data should be allowed. 273 // Now mock video capture, and no session data should be allowed.
273 MediaCaptureDevicesDispatcher::GetInstance()->OnMediaRequestStateChanged( 274 MediaCaptureDevicesDispatcher::GetInstance()->OnMediaRequestStateChanged(
274 0, 0, 0, GURL("http://www.google.com"), 275 0, 0, 0, GURL("http://www.google.com"),
275 content::MEDIA_DEVICE_VIDEO_CAPTURE, 276 content::MEDIA_DEVICE_VIDEO_CAPTURE,
276 content::MEDIA_REQUEST_STATE_OPENING); 277 content::MEDIA_REQUEST_STATE_OPENING);
277 base::RunLoop().RunUntilIdle(); 278 base::RunLoop().RunUntilIdle();
278 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed()); 279 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed());
279 } 280 }
280 281
281 } // namespace policy 282 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698