CTS tests for LOCATION_MODE

Change-Id: Ie05af4654549df049ca38b2a218eccbaa0450067
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 5d23eb5..fe54579 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -120,6 +120,7 @@
 	$(PTS_HOST_CASES) \
 	CtsAdbTests \
 	CtsAppSecurityTests \
+	CtsLocationHostTests \
 	CtsMonkeyTestCases \
 	CtsUsbTests
 
diff --git a/hostsidetests/location/Android.mk b/hostsidetests/location/Android.mk
new file mode 100644
index 0000000..344a726
--- /dev/null
+++ b/hostsidetests/location/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := CtsLocationHostTests
+
+LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed-prebuilt ddmlib-prebuilt junit
+
+LOCAL_CTS_TEST_PACKAGE := android.tests.location
+
+include $(BUILD_CTS_HOST_JAVA_LIBRARY)
+
+# Build the test APKs using their own makefiles
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/location/src/com/android/cts/location/LocationModeTest.java b/hostsidetests/location/src/com/android/cts/location/LocationModeTest.java
new file mode 100644
index 0000000..13c382a
--- /dev/null
+++ b/hostsidetests/location/src/com/android/cts/location/LocationModeTest.java
@@ -0,0 +1,35 @@
+// Copyright 2013 Google Inc. All Rights Reserved.
+
+package com.android.cts.location;
+
+import android.content.ContentResolver;
+import android.provider.Settings;
+import com.android.cts.tradefed.targetprep.SettingsToggler;
+import com.android.tradefed.testtype.DeviceTestCase;
+
+/**
+ * TODO(tomo): provide javadoc
+ *
+ * @author tomo@google.com (Tom O'Neill)
+ */
+public class LocationModeTest extends DeviceTestCase {
+
+    public void testFail() {
+        fail("confirmed that test actually ran");
+    }
+
+    public void testSuccess() {
+
+    }
+
+    public void testModeOff() throws Exception {
+//        SettingsToggler.setSecureInt(getDevice(),
+//                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
+        //TODO inline
+        SettingsToggler.setSecureInt(getDevice(), "location_mode", 0);
+
+        // What the client should write to the file:
+//        ContentResolver cr = null;
+//        int value = Settings.Secure.getInt(cr, Settings.Secure.LOCATION_MODE);
+    }
+}
diff --git a/tests/tests/location/README.txt b/tests/tests/location/README.txt
new file mode 100644
index 0000000..4692eab
--- /dev/null
+++ b/tests/tests/location/README.txt
@@ -0,0 +1,2 @@
+Location CTS tests that require "android.permission.ACCESS_FINE_LOCATION".
+Note you must enable "Allow mock locations" at Settings > Developer options.
diff --git a/tests/tests/location2/README.txt b/tests/tests/location2/README.txt
new file mode 100644
index 0000000..92241eb
--- /dev/null
+++ b/tests/tests/location2/README.txt
@@ -0,0 +1,3 @@
+Location CTS tests that require "android.permission.ACCESS_COARSE_LOCATION", but not
+"android.permission.ACCESS_FINE_LOCATION". Note you must enable "Allow mock locations"
+at Settings > Developer options.