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

Side by Side Diff: device/generic_sensor/platform_sensor_provider.cc

Issue 2434563005: [sensors] Add a browser test to sanity check ambient light sensor. (Closed)
Patch Set: Nit Created 4 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/generic_sensor/platform_sensor_provider.h"
6
7 #if defined(OS_MACOSX)
8 #include "device/generic_sensor/platform_sensor_provider_mac.h"
9 #elif defined(OS_ANDROID)
10 #include "device/generic_sensor/platform_sensor_provider_android.h"
11 #endif
12
13 namespace {
14
15 static device::PlatformSensorProvider* g_provider_for_testing = nullptr;
16 }
17
18 namespace device {
19
20 // static
21 void PlatformSensorProvider::SetProviderForTesting(
22 PlatformSensorProvider* provider) {
23 g_provider_for_testing = provider;
24 }
25
26 // static
27 PlatformSensorProvider* PlatformSensorProvider::GetInstance() {
28 if (g_provider_for_testing)
29 return g_provider_for_testing;
30 #if defined(OS_MACOSX)
31 return PlatformSensorProviderMac::GetInstance();
32 #elif defined(OS_ANDROID)
33 return PlatformSensorProviderAndroid::GetInstance();
34 #else
35 return nullptr;
36 #endif
37 }
38
39 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698