[email protected] | 4d245165 | 2012-02-14 23:54:26 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 10e59f313 | 2010-03-04 11:12:43 | [diff] [blame] | 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 "chrome/browser/extensions/extension_apitest.h" | ||||
Ke He | f417339 | 2018-06-29 07:44:15 | [diff] [blame] | 6 | #include "services/device/public/cpp/test/scoped_geolocation_overrider.h" |
[email protected] | 10e59f313 | 2010-03-04 11:12:43 | [diff] [blame] | 7 | |
Devlin Cronin | ef3e37e | 2018-05-14 23:47:24 | [diff] [blame] | 8 | class GeolocationApiTest : public extensions::ExtensionApiTest { |
[email protected] | 0bc24b5 | 2011-01-11 01:19:47 | [diff] [blame] | 9 | public: |
[email protected] | f7f9819 | 2012-01-24 17:10:26 | [diff] [blame] | 10 | GeolocationApiTest() { |
[email protected] | 10e59f313 | 2010-03-04 11:12:43 | [diff] [blame] | 11 | } |
[email protected] | b7d6acc | 2011-02-03 11:01:50 | [diff] [blame] | 12 | |
13 | // InProcessBrowserTest | ||||
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 14 | void SetUpOnMainThread() override { |
Ke He | 94a5b91 | 2017-12-15 03:38:55 | [diff] [blame] | 15 | geolocation_overrider_ = |
16 | std::make_unique<device::ScopedGeolocationOverrider>(0, 0); | ||||
[email protected] | b7d6acc | 2011-02-03 11:01:50 | [diff] [blame] | 17 | } |
Ke He | 94a5b91 | 2017-12-15 03:38:55 | [diff] [blame] | 18 | |
19 | private: | ||||
20 | std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; | ||||
[email protected] | 10e59f313 | 2010-03-04 11:12:43 | [diff] [blame] | 21 | }; |
22 | |||||
[email protected] | 4d245165 | 2012-02-14 23:54:26 | [diff] [blame] | 23 | // http://crbug.com/68287 |
[email protected] | 0bc24b5 | 2011-01-11 01:19:47 | [diff] [blame] | 24 | IN_PROC_BROWSER_TEST_F(GeolocationApiTest, |
[email protected] | 4d245165 | 2012-02-14 23:54:26 | [diff] [blame] | 25 | DISABLED_ExtensionGeolocationAccessFail) { |
[email protected] | 5ab79b0 | 2010-04-26 16:47:11 | [diff] [blame] | 26 | // Test that geolocation cannot be accessed from extension without permission. |
27 | ASSERT_TRUE(RunExtensionTest("geolocation/no_permission")) << message_; | ||||
28 | } | ||||
29 | |||||
[email protected] | dea2cca | 2012-05-21 20:33:32 | [diff] [blame] | 30 | // Timing out. http://crbug.com/128412 |
[email protected] | 6e74bf99 | 2012-05-17 11:21:20 | [diff] [blame] | 31 | IN_PROC_BROWSER_TEST_F(GeolocationApiTest, |
[email protected] | dea2cca | 2012-05-21 20:33:32 | [diff] [blame] | 32 | DISABLED_ExtensionGeolocationAccessPass) { |
[email protected] | 5ab79b0 | 2010-04-26 16:47:11 | [diff] [blame] | 33 | // Test that geolocation can be accessed from extension with permission. |
34 | ASSERT_TRUE(RunExtensionTest("geolocation/has_permission")) << message_; | ||||
[email protected] | 10e59f313 | 2010-03-04 11:12:43 | [diff] [blame] | 35 | } |