| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "content/test/mock_geolocation.h" | 6 #include "chrome/test/base/ui_test_utils.h" |
| 7 | 7 |
| 8 class GeolocationApiTest : public ExtensionApiTest { | 8 class GeolocationApiTest : public ExtensionApiTest { |
| 9 public: | 9 public: |
| 10 GeolocationApiTest() { | 10 GeolocationApiTest() { |
| 11 } | 11 } |
| 12 | 12 |
| 13 // InProcessBrowserTest | 13 // InProcessBrowserTest |
| 14 virtual void SetUpInProcessBrowserTestFixture() { | 14 virtual void SetUpOnMainThread() { |
| 15 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 15 ui_test_utils::OverrideGeolocation(0, 0); |
| 16 mock_geolocation_.Setup(); | |
| 17 } | 16 } |
| 18 | |
| 19 // InProcessBrowserTest | |
| 20 virtual void TearDownInProcessBrowserTestFixture() { | |
| 21 mock_geolocation_.TearDown(); | |
| 22 } | |
| 23 | |
| 24 private: | |
| 25 content::MockGeolocation mock_geolocation_; | |
| 26 }; | 17 }; |
| 27 | 18 |
| 28 // http://crbug.com/68287 | 19 // http://crbug.com/68287 |
| 29 IN_PROC_BROWSER_TEST_F(GeolocationApiTest, | 20 IN_PROC_BROWSER_TEST_F(GeolocationApiTest, |
| 30 DISABLED_ExtensionGeolocationAccessFail) { | 21 DISABLED_ExtensionGeolocationAccessFail) { |
| 31 // Test that geolocation cannot be accessed from extension without permission. | 22 // Test that geolocation cannot be accessed from extension without permission. |
| 32 ASSERT_TRUE(RunExtensionTest("geolocation/no_permission")) << message_; | 23 ASSERT_TRUE(RunExtensionTest("geolocation/no_permission")) << message_; |
| 33 } | 24 } |
| 34 | 25 |
| 35 IN_PROC_BROWSER_TEST_F(GeolocationApiTest, ExtensionGeolocationAccessPass) { | 26 IN_PROC_BROWSER_TEST_F(GeolocationApiTest, ExtensionGeolocationAccessPass) { |
| 36 // Test that geolocation can be accessed from extension with permission. | 27 // Test that geolocation can be accessed from extension with permission. |
| 37 ASSERT_TRUE(RunExtensionTest("geolocation/has_permission")) << message_; | 28 ASSERT_TRUE(RunExtensionTest("geolocation/has_permission")) << message_; |
| 38 } | 29 } |
| OLD | NEW |