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

Side by Side Diff: components/proximity_auth/proximity_monitor_impl_unittest.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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 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 "components/proximity_auth/proximity_monitor_impl.h" 5 #include "components/proximity_auth/proximity_monitor_impl.h"
6 6
7 #include <utility>
8
7 #include "base/macros.h" 9 #include "base/macros.h"
8 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/test/histogram_tester.h" 12 #include "base/test/histogram_tester.h"
11 #include "base/test/simple_test_tick_clock.h" 13 #include "base/test/simple_test_tick_clock.h"
12 #include "base/test/test_simple_task_runner.h" 14 #include "base/test/test_simple_task_runner.h"
13 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 16 #include "base/time/time.h"
15 #include "components/proximity_auth/logging/logging.h" 17 #include "components/proximity_auth/logging/logging.h"
16 #include "components/proximity_auth/proximity_monitor_observer.h" 18 #include "components/proximity_auth/proximity_monitor_observer.h"
(...skipping 15 matching lines...) Expand all
32 const char kRemoteDeviceUserId[] = "example@gmail.com"; 34 const char kRemoteDeviceUserId[] = "example@gmail.com";
33 const char kBluetoothAddress[] = "AA:BB:CC:DD:EE:FF"; 35 const char kBluetoothAddress[] = "AA:BB:CC:DD:EE:FF";
34 const char kRemoteDevicePublicKey[] = "Remote Public Key"; 36 const char kRemoteDevicePublicKey[] = "Remote Public Key";
35 const char kRemoteDeviceName[] = "LGE Nexus 5"; 37 const char kRemoteDeviceName[] = "LGE Nexus 5";
36 const char kPersistentSymmetricKey[] = "PSK"; 38 const char kPersistentSymmetricKey[] = "PSK";
37 39
38 class TestProximityMonitorImpl : public ProximityMonitorImpl { 40 class TestProximityMonitorImpl : public ProximityMonitorImpl {
39 public: 41 public:
40 explicit TestProximityMonitorImpl(const RemoteDevice& remote_device, 42 explicit TestProximityMonitorImpl(const RemoteDevice& remote_device,
41 scoped_ptr<base::TickClock> clock) 43 scoped_ptr<base::TickClock> clock)
42 : ProximityMonitorImpl(remote_device, clock.Pass()) {} 44 : ProximityMonitorImpl(remote_device, std::move(clock)) {}
43 ~TestProximityMonitorImpl() override {} 45 ~TestProximityMonitorImpl() override {}
44 46
45 using ProximityMonitorImpl::SetStrategy; 47 using ProximityMonitorImpl::SetStrategy;
46 48
47 private: 49 private:
48 DISALLOW_COPY_AND_ASSIGN(TestProximityMonitorImpl); 50 DISALLOW_COPY_AND_ASSIGN(TestProximityMonitorImpl);
49 }; 51 };
50 52
51 class MockProximityMonitorObserver : public ProximityMonitorObserver { 53 class MockProximityMonitorObserver : public ProximityMonitorObserver {
52 public: 54 public:
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 TEST_F(ProximityAuthProximityMonitorImplTest, 538 TEST_F(ProximityAuthProximityMonitorImplTest,
537 RecordProximityMetricsOnAuthSuccess_UnknownValues) { 539 RecordProximityMetricsOnAuthSuccess_UnknownValues) {
538 // Note: A device without a recorded name will have its Bluetooth address as 540 // Note: A device without a recorded name will have its Bluetooth address as
539 // its name. 541 // its name.
540 RemoteDevice unnamed_remote_device( 542 RemoteDevice unnamed_remote_device(
541 kRemoteDeviceUserId, kBluetoothAddress, kRemoteDevicePublicKey, 543 kRemoteDeviceUserId, kBluetoothAddress, kRemoteDevicePublicKey,
542 RemoteDevice::BLUETOOTH_CLASSIC, kBluetoothAddress, 544 RemoteDevice::BLUETOOTH_CLASSIC, kBluetoothAddress,
543 kPersistentSymmetricKey, std::string()); 545 kPersistentSymmetricKey, std::string());
544 546
545 scoped_ptr<base::TickClock> clock(new base::SimpleTestTickClock()); 547 scoped_ptr<base::TickClock> clock(new base::SimpleTestTickClock());
546 ProximityMonitorImpl monitor(unnamed_remote_device, clock.Pass()); 548 ProximityMonitorImpl monitor(unnamed_remote_device, std::move(clock));
547 monitor.AddObserver(&observer_); 549 monitor.AddObserver(&observer_);
548 monitor.Start(); 550 monitor.Start();
549 ProvideConnectionInfo({127, 127, 127}); 551 ProvideConnectionInfo({127, 127, 127});
550 552
551 base::HistogramTester histogram_tester; 553 base::HistogramTester histogram_tester;
552 monitor.RecordProximityMetricsOnAuthSuccess(); 554 monitor.RecordProximityMetricsOnAuthSuccess();
553 histogram_tester.ExpectUniqueSample("EasyUnlock.AuthProximity.RollingRssi", 555 histogram_tester.ExpectUniqueSample("EasyUnlock.AuthProximity.RollingRssi",
554 127, 1); 556 127, 1);
555 histogram_tester.ExpectUniqueSample( 557 histogram_tester.ExpectUniqueSample(
556 "EasyUnlock.AuthProximity.TransmitPowerDelta", 127, 1); 558 "EasyUnlock.AuthProximity.TransmitPowerDelta", 127, 1);
557 histogram_tester.ExpectUniqueSample( 559 histogram_tester.ExpectUniqueSample(
558 "EasyUnlock.AuthProximity.TimeSinceLastZeroRssi", 560 "EasyUnlock.AuthProximity.TimeSinceLastZeroRssi",
559 base::TimeDelta::FromSeconds(10).InMilliseconds(), 1); 561 base::TimeDelta::FromSeconds(10).InMilliseconds(), 1);
560 histogram_tester.ExpectUniqueSample( 562 histogram_tester.ExpectUniqueSample(
561 "EasyUnlock.AuthProximity.RemoteDeviceModelHash", 563 "EasyUnlock.AuthProximity.RemoteDeviceModelHash",
562 -1808066424 /* hash of "Unknown" */, 1); 564 -1808066424 /* hash of "Unknown" */, 1);
563 } 565 }
564 566
565 } // namespace proximity_auth 567 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/proximity_monitor_impl.cc ('k') | components/proximity_auth/remote_device_life_cycle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698