Index: content/browser/geolocation/geolocation_provider_unittest.cc |
diff --git a/content/browser/geolocation/geolocation_provider_unittest.cc b/content/browser/geolocation/geolocation_provider_unittest.cc |
index 1b131e93d59a11dfc42754b68cebfca15f412196..d4aa5cd6ed3ad93fa17f46e533d3024ec2cb139c 100644 |
--- a/content/browser/geolocation/geolocation_provider_unittest.cc |
+++ b/content/browser/geolocation/geolocation_provider_unittest.cc |
@@ -2,7 +2,6 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/memory/singleton.h" |
#include "base/synchronization/waitable_event.h" |
#include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h" |
#include "content/browser/geolocation/fake_access_token_store.h" |
@@ -11,6 +10,7 @@ |
#include "content/browser/geolocation/mock_location_provider.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "content/test/test_browser_thread.h" |
using content::AccessTokenStore; |
using content::FakeAccessTokenStore; |
@@ -22,20 +22,25 @@ using testing::InvokeWithoutArgs; |
namespace { |
+// A GeolocationProvider that can be constructed and destructed for testing. |
+class NonSingletonGeolocationProvider : public GeolocationProvider { |
+ public: |
+ NonSingletonGeolocationProvider() : GeolocationProvider() { } |
+ |
+ virtual ~NonSingletonGeolocationProvider() {} |
+}; |
+ |
class GeolocationProviderTest : public testing::Test { |
protected: |
GeolocationProviderTest() |
- : provider_(new GeolocationProvider), |
+ : io_thread_(content::BrowserThread::IO, &message_loop_), |
+ provider_(new NonSingletonGeolocationProvider), |
dependency_factory_( |
new GeolocationArbitratorDependencyFactoryWithLocationProvider( |
&NewAutoSuccessMockNetworkLocationProvider)) |
{ |
} |
- ~GeolocationProviderTest() { |
- DefaultSingletonTraits<GeolocationProvider>::Delete(provider_); |
- } |
- |
// testing::Test |
virtual void SetUp() { |
GeolocationArbitrator::SetDependencyFactoryForTest( |
@@ -48,12 +53,11 @@ class GeolocationProviderTest : public testing::Test { |
GeolocationArbitrator::SetDependencyFactoryForTest(NULL); |
} |
- // Message loop for main thread, as provider depends on it existing. |
+ // The GeolocationProvider expects to be instantiated on the IO thread. |
MessageLoop message_loop_; |
+ content::TestBrowserThread io_thread_; |
- // Object under tests. Owned, but not a scoped_ptr due to specialized |
- // destruction protocol. |
- GeolocationProvider* provider_; |
+ scoped_ptr<NonSingletonGeolocationProvider> provider_; |
scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; |
}; |