blob: 76bbfbb97b8199900b63c3654271b7abacd24a3c [file] [log] [blame]
[email protected]4d2451652012-02-14 23:54:261// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]10e59f3132010-03-04 11:12:432// 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 Hef4173392018-06-29 07:44:156#include "services/device/public/cpp/test/scoped_geolocation_overrider.h"
[email protected]10e59f3132010-03-04 11:12:437
Devlin Croninef3e37e2018-05-14 23:47:248class GeolocationApiTest : public extensions::ExtensionApiTest {
[email protected]0bc24b52011-01-11 01:19:479 public:
[email protected]f7f98192012-01-24 17:10:2610 GeolocationApiTest() {
[email protected]10e59f3132010-03-04 11:12:4311 }
[email protected]b7d6acc2011-02-03 11:01:5012
13 // InProcessBrowserTest
dchengae36a4a2014-10-21 12:36:3614 void SetUpOnMainThread() override {
Ke He94a5b912017-12-15 03:38:5515 geolocation_overrider_ =
16 std::make_unique<device::ScopedGeolocationOverrider>(0, 0);
[email protected]b7d6acc2011-02-03 11:01:5017 }
Ke He94a5b912017-12-15 03:38:5518
19 private:
20 std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_;
[email protected]10e59f3132010-03-04 11:12:4321};
22
[email protected]4d2451652012-02-14 23:54:2623// http://crbug.com/68287
[email protected]0bc24b52011-01-11 01:19:4724IN_PROC_BROWSER_TEST_F(GeolocationApiTest,
[email protected]4d2451652012-02-14 23:54:2625 DISABLED_ExtensionGeolocationAccessFail) {
[email protected]5ab79b02010-04-26 16:47:1126 // Test that geolocation cannot be accessed from extension without permission.
27 ASSERT_TRUE(RunExtensionTest("geolocation/no_permission")) << message_;
28}
29
[email protected]dea2cca2012-05-21 20:33:3230// Timing out. http://crbug.com/128412
[email protected]6e74bf992012-05-17 11:21:2031IN_PROC_BROWSER_TEST_F(GeolocationApiTest,
[email protected]dea2cca2012-05-21 20:33:3232 DISABLED_ExtensionGeolocationAccessPass) {
[email protected]5ab79b02010-04-26 16:47:1133 // Test that geolocation can be accessed from extension with permission.
34 ASSERT_TRUE(RunExtensionTest("geolocation/has_permission")) << message_;
[email protected]10e59f3132010-03-04 11:12:4335}