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

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

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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 "base/prefs/testing_pref_service.h" 5 #include "base/prefs/testing_pref_service.h"
6 #include "base/test/test_simple_task_runner.h" 6 #include "base/test/test_simple_task_runner.h"
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "chrome/browser/chromeos/policy/device_local_account.h" 8 #include "chrome/browser/chromeos/policy/device_local_account.h"
9 #include "chrome/browser/chromeos/policy/device_status_collector.h" 9 #include "chrome/browser/chromeos/policy/device_status_collector.h"
10 #include "chrome/browser/chromeos/policy/status_uploader.h" 10 #include "chrome/browser/chromeos/policy/status_uploader.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 #if defined(USE_X11) 227 #if defined(USE_X11)
228 ui::ScopedXI2Event native_event; 228 ui::ScopedXI2Event native_event;
229 const int kPointerDeviceId = 10; 229 const int kPointerDeviceId = 10;
230 std::vector<int> device_list; 230 std::vector<int> device_list;
231 device_list.push_back(kPointerDeviceId); 231 device_list.push_back(kPointerDeviceId);
232 ui::TouchFactory::GetInstance()->SetPointerDeviceForTest(device_list); 232 ui::TouchFactory::GetInstance()->SetPointerDeviceForTest(device_list);
233 native_event.InitGenericButtonEvent( 233 native_event.InitGenericButtonEvent(
234 kPointerDeviceId, ui::ET_MOUSE_PRESSED, gfx::Point(), 234 kPointerDeviceId, ui::ET_MOUSE_PRESSED, gfx::Point(),
235 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_CONTROL_DOWN); 235 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_CONTROL_DOWN);
236 #elif defined(USE_OZONE) 236 #elif defined(USE_OZONE)
237 ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 237 ui::MouseEvent e(
238 ui::EventTimeForNow(), 0, 0); 238 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
239 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
239 const ui::PlatformEvent& native_event = &e; 240 const ui::PlatformEvent& native_event = &e;
240 #endif 241 #endif
241 ui::UserActivityDetector::Get()->DidProcessEvent(native_event); 242 ui::UserActivityDetector::Get()->DidProcessEvent(native_event);
242 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed()); 243 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed());
243 } 244 }
244 #endif 245 #endif
245 246
246 TEST_F(StatusUploaderTest, NoUploadAfterVideoCapture) { 247 TEST_F(StatusUploaderTest, NoUploadAfterVideoCapture) {
247 StatusUploader uploader(&client_, collector_.Pass(), task_runner_); 248 StatusUploader uploader(&client_, collector_.Pass(), task_runner_);
248 // Should allow data upload before there is video capture. 249 // Should allow data upload before there is video capture.
249 EXPECT_TRUE(uploader.IsSessionDataUploadAllowed()); 250 EXPECT_TRUE(uploader.IsSessionDataUploadAllowed());
250 251
251 // Now mock video capture, and no session data should be allowed. 252 // Now mock video capture, and no session data should be allowed.
252 MediaCaptureDevicesDispatcher::GetInstance()->OnMediaRequestStateChanged( 253 MediaCaptureDevicesDispatcher::GetInstance()->OnMediaRequestStateChanged(
253 0, 0, 0, GURL("http://www.google.com"), 254 0, 0, 0, GURL("http://www.google.com"),
254 content::MEDIA_DEVICE_VIDEO_CAPTURE, 255 content::MEDIA_DEVICE_VIDEO_CAPTURE,
255 content::MEDIA_REQUEST_STATE_OPENING); 256 content::MEDIA_REQUEST_STATE_OPENING);
256 base::RunLoop().RunUntilIdle(); 257 base::RunLoop().RunUntilIdle();
257 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed()); 258 EXPECT_FALSE(uploader.IsSessionDataUploadAllowed());
258 } 259 }
259 260
260 } // namespace policy 261 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698