Commit 5ba9c9ae authored by jknotten@chromium.org's avatar jknotten@chromium.org

Put geolocation unit and browser test code in anonymous namespaces.

Avoid overlapping class definitions (e.g. MessageLoopQuitListener).

BUG=None
TEST=unit_tests,browser_tests

Review URL: http://codereview.chromium.org/6341013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72793 0039d316-1c4b-4281-b951-d872f2087c98
parent b20c4619
......@@ -11,13 +11,13 @@
#include "chrome/test/ui_test_utils.h"
namespace {
// The token store factory implementation expects to be used from any well-known
// chrome thread other than UI. We could use any arbitrary thread; IO is
// a good choice as this is the expected usage.
const BrowserThread::ID kExpectedClientThreadId = BrowserThread::IO;
const char* kRefServerUrl1 = "https://test.domain.example/foo?id=bar.bar";
const char* kRefServerUrl2 = "http://another.domain.example/foo?id=bar.bar#2";
} // namespace
class GeolocationAccessTokenStoreTest
: public InProcessBrowserTest {
......@@ -149,3 +149,5 @@ IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, CancelRequest) {
RunCancelTestInClientTread));
ui_test_utils::RunMessageLoop();
}
} // namespace
......@@ -9,6 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
class NullWifiDataListenerInterface
: public WifiDataProviderCommon::ListenerInterface {
public:
......@@ -16,7 +17,6 @@ class NullWifiDataListenerInterface
virtual void DeviceDataUpdateAvailable(
DeviceDataProvider<WifiData>* provider) {}
};
}
TEST(GeolocationDeviceDataProviderWifiData, CreateDestroy) {
// See http://crbug.com/59913 . The main_message_loop is not required to be
......@@ -38,3 +38,5 @@ TEST(GeolocationDeviceDataProviderWifiData, CreateDestroy) {
}
}
}
} // namespace
......@@ -17,6 +17,8 @@ using testing::DoDefault;
using testing::Invoke;
using testing::Return;
namespace {
class MockGatewayApi : public GatewayDataProviderCommon::GatewayApiInterface {
public:
MockGatewayApi() {
......@@ -185,3 +187,5 @@ TEST_F(GeolocationGatewayDataProviderCommonTest, DoScanWithResults) {
EXPECT_EQ(1, static_cast<int>(data.router_data.size()));
EXPECT_EQ(single_router.mac_address, data.router_data.begin()->mac_address);
}
} // namespace
......@@ -27,6 +27,8 @@
#include "net/base/net_util.h"
#include "net/test/test_server.h"
namespace {
// Used to block until an iframe is loaded via a javascript call.
// Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for
// multiple embedded iframes, as notifications seem to be 'batched'. Instead, we
......@@ -635,3 +637,5 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_TabDestroyed) {
L"", UTF8ToWide(script));
EXPECT_EQ(result, true);
}
} // namespace
......@@ -15,7 +15,6 @@ namespace {
const GURL kUrl0("http://www.example.com");
const GURL kUrl1("http://www.example1.com");
const GURL kUrl2("http://www.example2.com");
} // namespace
class GeolocationExceptionsTableModelTest : public RenderViewHostTestHarness {
public:
......@@ -141,3 +140,5 @@ TEST_F(GeolocationExceptionsTableModelTest, GetText) {
EXPECT_NE(string16::npos,
text.find(content_settings_helper::OriginToString16(kUrl2)));
}
} // namespace
......@@ -21,6 +21,8 @@
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
// TestTabContents short-circuits TAB_CONTENTS_INFOBAR_REMOVED to call
// InfoBarClosed() directly. We need to observe it and call InfoBarClosed()
// later.
......@@ -421,3 +423,5 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
// Delete the tab contents.
DeleteContents();
}
} // namespace
......@@ -14,6 +14,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
// Constants used in multiple tests.
const char kTestServerUrl[] = "https://www.geolocation.test/service";
const char kTestHost[] = "myclienthost.test";
......@@ -21,8 +22,6 @@ const char kTestHostUrl[] = "http://myclienthost.test/some/path";
// Using #define so we can easily paste this into various other strings.
#define REFERENCE_ACCESS_TOKEN "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe"
} // namespace
// Stops the specified (nested) message loop when the listener is called back.
class MessageLoopQuitListener
: public LocationProviderBase::ListenerInterface {
......@@ -779,3 +778,4 @@ TEST_F(GeolocationNetworkProviderTest, NetworkPositionCache) {
}
}
} // namespace
......@@ -19,6 +19,8 @@ using testing::DoDefault;
using testing::Invoke;
using testing::Return;
namespace {
class MockWlanApi : public WifiDataProviderCommon::WlanApiInterface {
public:
MockWlanApi() : calls_(0), bool_return_(true) {
......@@ -225,3 +227,6 @@ TEST_F(GeolocationWifiDataProviderCommonTest,
DeviceDataProvider<WifiData>::Unregister(&quit_listener);
DeviceDataProvider<WifiData>::ResetFactory();
}
} // namespace
......@@ -23,6 +23,8 @@ using testing::DoDefault;
using testing::Invoke;
using testing::Return;
namespace {
class MockLatLongReport : public ILatLongReport {
public:
MockLatLongReport() : ref_count_(1) {
......@@ -331,3 +333,5 @@ TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) {
api_->GetPosition(&position);
EXPECT_FALSE(position.IsValidFix());
}
} // namespace
......@@ -16,6 +16,7 @@ using testing::DoDefault;
using testing::Invoke;
using testing::Return;
namespace {
class MockWin7LocationApi : public Win7LocationApi {
public:
......@@ -136,3 +137,5 @@ TEST_F(GeolocationProviderWin7Tests, GetInvalidPosition) {
provider_->GetPosition(&position);
EXPECT_FALSE(position.IsValidFix());
}
} // namespace
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment