diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-09 00:35:47 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-09 00:35:47 +0000 |
commit | 2d3b7766506922d50aa2585c1a596350d57ad238 (patch) | |
tree | cb85915944eba0f47577c660682b4868780e816c /net/base/network_change_notifier.cc | |
parent | ff9cebb3f64df1c0c779a8a60daee57da7f9b667 (diff) | |
download | chromium_src-2d3b7766506922d50aa2585c1a596350d57ad238.zip chromium_src-2d3b7766506922d50aa2585c1a596350d57ad238.tar.gz chromium_src-2d3b7766506922d50aa2585c1a596350d57ad238.tar.bz2 |
Return ERR_INTERNET_DISCONNECTED in place of ERR_NAME_NOT_RESOLVED and ERR_ADDRESS_UNREACHABLE, when the user is in offline mode.
This initial changelist includes the implementation just for Windows.
BUG=53473
TEST=unplug network cable, try to connect to www.google.com --> should get the error ERR_INTERNET_DISCONNECTED. Next, try connecting directly to an IP address --> should get the error ERR_INTERNET_DISCONNECTED.
Review URL: http://codereview.chromium.org/3634002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_change_notifier.cc')
-rw-r--r-- | net/base/network_change_notifier.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc index d069879..8c61ac6 100644 --- a/net/base/network_change_notifier.cc +++ b/net/base/network_change_notifier.cc @@ -22,6 +22,11 @@ namespace { // anyway.) NetworkChangeNotifier* g_network_change_notifier = NULL; +class MockNetworkChangeNotifier : public NetworkChangeNotifier { + public: + virtual bool IsCurrentlyOffline() const { return false; } +}; + } // namespace NetworkChangeNotifier::~NetworkChangeNotifier() { @@ -42,6 +47,17 @@ NetworkChangeNotifier* NetworkChangeNotifier::Create() { #endif } +// static +bool NetworkChangeNotifier::IsOffline() { + return g_network_change_notifier && + g_network_change_notifier->IsCurrentlyOffline(); +} + +// static +NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() { + return new MockNetworkChangeNotifier(); +} + void NetworkChangeNotifier::AddObserver(Observer* observer) { if (g_network_change_notifier) g_network_change_notifier->observer_list_->AddObserver(observer); |