diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 21:59:55 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 21:59:55 +0000 |
commit | 3c3065d5e74b5487f94f2f8f17be9169d4f805fc (patch) | |
tree | 314c61f8c7d2a6b1464e38455c6b69d807e95ec4 | |
parent | dde46b66c618a3ab242ddfbceb0290699a32012c (diff) | |
download | chromium_src-3c3065d5e74b5487f94f2f8f17be9169d4f805fc.zip chromium_src-3c3065d5e74b5487f94f2f8f17be9169d4f805fc.tar.gz chromium_src-3c3065d5e74b5487f94f2f8f17be9169d4f805fc.tar.bz2 |
Moved everything in browser/sync/net to common/net.
This is so it can be used by both common/net/notifier and browser/sync.
Removed unused and rotted unittest file.
BUG=42606
TEST=trybots
Review URL: http://codereview.chromium.org/2022001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46634 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/chrome.gyp | 16 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 1 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 32 | ||||
-rw-r--r-- | chrome/chrome_renderer.gypi | 1 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 88 | ||||
-rw-r--r-- | chrome/common/net/fake_network_change_notifier_thread.cc (renamed from chrome/browser/sync/net/fake_network_change_notifier_thread.cc) | 17 | ||||
-rw-r--r-- | chrome/common/net/fake_network_change_notifier_thread.h (renamed from chrome/browser/sync/net/fake_network_change_notifier_thread.h) | 12 | ||||
-rw-r--r-- | chrome/common/net/fake_network_change_notifier_thread_unittest.cc (renamed from chrome/browser/sync/net/fake_network_change_notifier_thread_unittest.cc) | 18 | ||||
-rw-r--r-- | chrome/common/net/mock_network_change_observer.h (renamed from chrome/browser/sync/net/mock_network_change_observer.h) | 10 | ||||
-rw-r--r-- | chrome/common/net/network_change_notifier_proxy.cc (renamed from chrome/browser/sync/net/network_change_notifier_proxy.cc) | 8 | ||||
-rw-r--r-- | chrome/common/net/network_change_notifier_proxy.h (renamed from chrome/browser/sync/net/network_change_notifier_proxy.h) | 10 | ||||
-rw-r--r-- | chrome/common/net/network_change_notifier_proxy_unittest.cc (renamed from chrome/browser/sync/net/network_change_notifier_proxy_unittest.cc) | 10 | ||||
-rw-r--r-- | chrome/common/net/network_change_notifier_thread.h (renamed from chrome/browser/sync/net/network_change_notifier_thread.h) | 10 | ||||
-rw-r--r-- | chrome/common/net/network_change_observer_proxy.cc (renamed from chrome/browser/sync/net/network_change_observer_proxy.cc) | 8 | ||||
-rw-r--r-- | chrome/common/net/network_change_observer_proxy.h (renamed from chrome/browser/sync/net/network_change_observer_proxy.h) | 10 | ||||
-rw-r--r-- | chrome/common/net/network_change_observer_proxy_unittest.cc (renamed from chrome/browser/sync/net/network_change_observer_proxy_unittest.cc) | 10 | ||||
-rw-r--r-- | chrome/common/net/thread_blocker.cc (renamed from chrome/browser/sync/net/thread_blocker.cc) | 12 | ||||
-rw-r--r-- | chrome/common/net/thread_blocker.h (renamed from chrome/browser/sync/net/thread_blocker.h) | 10 | ||||
-rw-r--r-- | chrome/common/net/thread_blocker_unittest.cc (renamed from chrome/browser/sync/net/thread_blocker_unittest.cc) | 18 | ||||
-rw-r--r-- | chrome/common/net/url_util_unittest.cc | 52 |
20 files changed, 154 insertions, 199 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 265a336..614521c 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -974,22 +974,6 @@ }], ], }, - { - # TODO(akalin): Consider moving this into its own file. - 'target_name': 'sync_net', - 'type': '<(library)', - 'sources': [ - 'browser/sync/net/network_change_notifier_proxy.cc', - 'browser/sync/net/network_change_notifier_proxy.h', - 'browser/sync/net/network_change_notifier_thread.h', - 'browser/sync/net/network_change_observer_proxy.cc', - 'browser/sync/net/network_change_observer_proxy.h', - ], - 'dependencies': [ - '../base/base.gyp:base', - '../net/net.gyp:net_base', - ], - }, ], 'conditions': [ ['OS=="mac"', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 4ad580d..23235d4 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -10,6 +10,7 @@ 'msvs_guid': '5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA', 'dependencies': [ 'common', + 'common_net', 'chrome_resources', 'chrome_strings', 'chrome_version_info', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 3d9c4f9..93728d5 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -119,6 +119,7 @@ 'chrome_resources', 'chrome_strings', 'common_constants', + 'common_net', 'theme_resources', '../app/app.gyp:app_base', '../app/app.gyp:app_resources', @@ -127,7 +128,6 @@ '../build/temp_gyp/googleurl.gyp:googleurl', '../ipc/ipc.gyp:ipc', '../net/net.gyp:net', - '../net/net.gyp:net_resources', '../skia/skia.gyp:skia', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', @@ -172,12 +172,6 @@ 'common/extensions/user_script.cc', 'common/extensions/user_script.h', 'common/gfx/utils.h', - 'common/net/dns.h', - 'common/net/net_resource_provider.cc', - 'common/net/net_resource_provider.h', - 'common/net/socket_stream.h', - 'common/net/url_request_intercept_job.cc', - 'common/net/url_request_intercept_job.h', 'common/web_resource/web_resource_unpacker.cc', 'common/web_resource/web_resource_unpacker.h', 'common/appcache/appcache_backend_proxy.cc', @@ -307,6 +301,30 @@ '../app/app.gyp:app_base', ], }, + { + 'target_name': 'common_net', + 'type': '<(library)', + 'sources': [ + 'common/net/dns.h', + 'common/net/net_resource_provider.cc', + 'common/net/net_resource_provider.h', + 'common/net/network_change_notifier_proxy.cc', + 'common/net/network_change_notifier_proxy.h', + 'common/net/network_change_notifier_thread.h', + 'common/net/network_change_observer_proxy.cc', + 'common/net/network_change_observer_proxy.h', + 'common/net/socket_stream.h', + 'common/net/url_request_intercept_job.cc', + 'common/net/url_request_intercept_job.h', + ], + 'dependencies': [ + 'chrome_resources', + 'chrome_strings', + '../base/base.gyp:base', + '../net/net.gyp:net_base', + '../net/net.gyp:net_resources', + ], + }, ], 'conditions': [ ['OS=="win"', { diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index cf6f8bf..b5c9281 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -10,6 +10,7 @@ 'msvs_guid': '9301A569-5D2B-4D11-9332-B1E30AEACB8D', 'dependencies': [ 'common', + 'common_net', 'plugin', 'chrome_resources', 'chrome_strings', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 97ba4dc..184c14b 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -980,7 +980,6 @@ 'common/extensions/user_script_unittest.cc', 'common/json_value_serializer_unittest.cc', 'common/mru_cache_unittest.cc', - 'common/net/url_util_unittest.cc', 'common/notification_service_unittest.cc', 'common/process_watcher_unittest.cc', 'common/property_bag_unittest.cc', @@ -1163,7 +1162,6 @@ ], 'sources!': [ 'browser/gtk/tabs/tab_renderer_gtk_unittest.cc', - 'common/net/url_util_unittest.cc', ], 'link_settings': { 'libraries': [ @@ -1202,7 +1200,6 @@ 'browser/views/find_bar_host_unittest.cc', 'browser/views/generic_info_view_unittest.cc', 'browser/views/keyword_editor_view_unittest.cc', - 'common/net/url_util_unittest.cc', ], }], ['OS=="linux" or OS=="freebsd"', { @@ -1669,6 +1666,51 @@ ], # conditions }, { + # TODO(akalin): Add this to all.gyp. + 'target_name': 'common_net_unit_tests', + 'type': 'executable', + 'sources': [ + # TODO(akalin): Write our own test suite and runner. + '../base/test/run_all_unittests.cc', + '../base/test/test_suite.h', + 'common/net/fake_network_change_notifier_thread_unittest.cc', + 'common/net/fake_network_change_notifier_thread.cc', + 'common/net/fake_network_change_notifier_thread.h', + 'common/net/mock_network_change_observer.h', + 'common/net/network_change_notifier_proxy_unittest.cc', + 'common/net/network_change_observer_proxy_unittest.cc', + 'common/net/thread_blocker_unittest.cc', + 'common/net/thread_blocker.cc', + 'common/net/thread_blocker.h', + ], + 'include_dirs': [ + '..', + ], + 'dependencies': [ + 'common_net', + '../build/temp_gyp/googleurl.gyp:googleurl', + '../testing/gmock.gyp:gmock', + '../testing/gtest.gyp:gtest', + ], + # TODO(akalin): Remove this once we have our own test suite and + # runner. + 'conditions': [ + ['OS == "win"', { + 'sources!': [ + 'common/net/url_util_unittest.cc', + ], + }], + ['OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { + 'dependencies': [ + # Needed to handle the #include chain: + # base/test/test_suite.h + # gtk/gtk.h + '../build/linux/system.gyp:gtk', + ], + }], + ], + }, + { 'target_name': 'notifier_unit_tests', 'type': 'executable', 'sources': [ @@ -1837,46 +1879,6 @@ ], }, { - # TODO(akalin): Add this to all.gyp. - # TODO(akalin): Consider moving this into its own file. - 'target_name': 'sync_net_unit_tests', - 'type': 'executable', - 'sources': [ - # TODO(akalin): Write our own test suite and runner. - '../base/test/run_all_unittests.cc', - '../base/test/test_suite.h', - 'browser/sync/net/fake_network_change_notifier_thread_unittest.cc', - 'browser/sync/net/fake_network_change_notifier_thread.cc', - 'browser/sync/net/fake_network_change_notifier_thread.h', - 'browser/sync/net/mock_network_change_observer.h', - 'browser/sync/net/network_change_notifier_proxy_unittest.cc', - 'browser/sync/net/network_change_observer_proxy_unittest.cc', - 'browser/sync/net/thread_blocker_unittest.cc', - 'browser/sync/net/thread_blocker.cc', - 'browser/sync/net/thread_blocker.h', - ], - 'include_dirs': [ - '..', - ], - 'dependencies': [ - 'sync_net', - '../testing/gmock.gyp:gmock', - '../testing/gtest.gyp:gtest', - ], - # TODO(akalin): Remove this once we have our own test suite and - # runner. - 'conditions': [ - ['OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { - 'dependencies': [ - # Needed to handle the #include chain: - # base/test/test_suite.h - # gtk/gtk.h - '../build/linux/system.gyp:gtk', - ], - }], - ], - }, - { 'target_name': 'sync_integration_tests', 'type': 'executable', 'dependencies': [ diff --git a/chrome/browser/sync/net/fake_network_change_notifier_thread.cc b/chrome/common/net/fake_network_change_notifier_thread.cc index f0d9c25..63930ac 100644 --- a/chrome/browser/sync/net/fake_network_change_notifier_thread.cc +++ b/chrome/common/net/fake_network_change_notifier_thread.cc @@ -2,22 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/fake_network_change_notifier_thread.h" +#include "chrome/common/net/fake_network_change_notifier_thread.h" #include "base/logging.h" #include "base/message_loop.h" -#include "chrome/browser/sync/net/thread_blocker.h" +#include "chrome/common/net/thread_blocker.h" #include "net/base/mock_network_change_notifier.h" // We manage the lifetime of -// browser_sync::FakeNetworkChangeNotifierThread ourselves. +// chrome_common_net::FakeNetworkChangeNotifierThread ourselves. template <> -struct RunnableMethodTraits<browser_sync::FakeNetworkChangeNotifierThread> { - void RetainCallee(browser_sync::FakeNetworkChangeNotifierThread*) {} - void ReleaseCallee(browser_sync::FakeNetworkChangeNotifierThread*) {} +struct RunnableMethodTraits<chrome_common_net:: + FakeNetworkChangeNotifierThread> { + void RetainCallee(chrome_common_net::FakeNetworkChangeNotifierThread*) {} + void ReleaseCallee(chrome_common_net::FakeNetworkChangeNotifierThread*) {} }; -namespace browser_sync { +namespace chrome_common_net { FakeNetworkChangeNotifierThread::FakeNetworkChangeNotifierThread() : thread_("FakeNetworkChangeNotifierThread") {} @@ -77,4 +78,4 @@ FakeNetworkChangeNotifierThread::GetNetworkChangeNotifier() const { return network_change_notifier_.get(); } -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/fake_network_change_notifier_thread.h b/chrome/common/net/fake_network_change_notifier_thread.h index ccc3225..5a594f1 100644 --- a/chrome/browser/sync/net/fake_network_change_notifier_thread.h +++ b/chrome/common/net/fake_network_change_notifier_thread.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_NET_FAKE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ -#define CHROME_BROWSER_SYNC_NET_FAKE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ +#ifndef CHROME_COMMON_NET_FAKE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ +#define CHROME_COMMON_NET_FAKE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ // A fake implementation of NetworkChangeNotifierThread used for // unit-testing. @@ -11,13 +11,13 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/thread.h" -#include "chrome/browser/sync/net/network_change_notifier_thread.h" +#include "chrome/common/net/network_change_notifier_thread.h" namespace net { class MockNetworkChangeNotifier; } // namespace net -namespace browser_sync { +namespace chrome_common_net { class ThreadBlocker; @@ -59,6 +59,6 @@ class FakeNetworkChangeNotifierThread : public NetworkChangeNotifierThread { DISALLOW_COPY_AND_ASSIGN(FakeNetworkChangeNotifierThread); }; -} // namespace browser_sync +} // namespace chrome_common_net -#endif // CHROME_BROWSER_SYNC_NET_FAKE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ +#endif // CHROME_COMMON_NET_FAKE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ diff --git a/chrome/browser/sync/net/fake_network_change_notifier_thread_unittest.cc b/chrome/common/net/fake_network_change_notifier_thread_unittest.cc index 02828ce..0cfb741 100644 --- a/chrome/browser/sync/net/fake_network_change_notifier_thread_unittest.cc +++ b/chrome/common/net/fake_network_change_notifier_thread_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/fake_network_change_notifier_thread.h" +#include "chrome/common/net/fake_network_change_notifier_thread.h" #include "base/basictypes.h" #include "base/logging.h" @@ -11,18 +11,18 @@ #include "net/base/network_change_notifier.h" #include "testing/gtest/include/gtest/gtest.h" -namespace browser_sync { +namespace chrome_common_net { class FlagToggler; -} // namespace browser_sync +} // namespace chrome_common_net -// We manage the lifetime of browser_sync::FlagToggler ourselves. +// We manage the lifetime of chrome_common_net::FlagToggler ourselves. template <> -struct RunnableMethodTraits<browser_sync::FlagToggler> { - void RetainCallee(browser_sync::FlagToggler*) {} - void ReleaseCallee(browser_sync::FlagToggler*) {} +struct RunnableMethodTraits<chrome_common_net::FlagToggler> { + void RetainCallee(chrome_common_net::FlagToggler*) {} + void ReleaseCallee(chrome_common_net::FlagToggler*) {} }; -namespace browser_sync { +namespace chrome_common_net { // Utility class that toggles a flag every time it receives an IP // address change notification. @@ -118,4 +118,4 @@ TEST_F(FakeNetworkChangeNotifierTest, Multiple) { } // namespace -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/mock_network_change_observer.h b/chrome/common/net/mock_network_change_observer.h index 91a5ef9..10a02a8 100644 --- a/chrome/browser/sync/net/mock_network_change_observer.h +++ b/chrome/common/net/mock_network_change_observer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_NET_MOCK_NETWORK_CHANGE_OBSERVER_H_ -#define CHROME_BROWSER_SYNC_NET_MOCK_NETWORK_CHANGE_OBSERVER_H_ +#ifndef CHROME_COMMON_NET_MOCK_NETWORK_CHANGE_OBSERVER_H_ +#define CHROME_COMMON_NET_MOCK_NETWORK_CHANGE_OBSERVER_H_ #include "base/basictypes.h" #include "net/base/network_change_notifier.h" @@ -12,7 +12,7 @@ // This class is a mock net::NetworkChangeNotifier::Observer used in // unit tests. -namespace browser_sync { +namespace chrome_common_net { class MockNetworkChangeObserver : public net::NetworkChangeNotifier::Observer { @@ -27,6 +27,6 @@ class MockNetworkChangeObserver DISALLOW_COPY_AND_ASSIGN(MockNetworkChangeObserver); }; -} // namespace browser_sync +} // namespace chrome_common_net -#endif // CHROME_BROWSER_SYNC_NET_MOCK_NETWORK_CHANGE_OBSERVER_H_ +#endif // CHROME_COMMON_NET_MOCK_NETWORK_CHANGE_OBSERVER_H_ diff --git a/chrome/browser/sync/net/network_change_notifier_proxy.cc b/chrome/common/net/network_change_notifier_proxy.cc index e1b3797..8a25d22 100644 --- a/chrome/browser/sync/net/network_change_notifier_proxy.cc +++ b/chrome/common/net/network_change_notifier_proxy.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/network_change_notifier_proxy.h" +#include "chrome/common/net/network_change_notifier_proxy.h" #include "base/logging.h" #include "base/message_loop.h" -#include "chrome/browser/sync/net/network_change_observer_proxy.h" +#include "chrome/common/net/network_change_observer_proxy.h" -namespace browser_sync { +namespace chrome_common_net { NetworkChangeNotifierProxy::NetworkChangeNotifierProxy( NetworkChangeNotifierThread* source_thread) @@ -56,4 +56,4 @@ void NetworkChangeNotifierProxy::ObserverRepeater::OnIPAddressChanged() { *observers_, OnIPAddressChanged()); } -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/network_change_notifier_proxy.h b/chrome/common/net/network_change_notifier_proxy.h index 2789abc..916d5f8 100644 --- a/chrome/browser/sync/net/network_change_notifier_proxy.h +++ b/chrome/common/net/network_change_notifier_proxy.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_NOTIFIER_PROXY_H_ -#define CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_NOTIFIER_PROXY_H_ +#ifndef CHROME_COMMON_NET_NETWORK_CHANGE_NOTIFIER_PROXY_H_ +#define CHROME_COMMON_NET_NETWORK_CHANGE_NOTIFIER_PROXY_H_ // NetworkChangeNotifierProxy is a class that lets observers listen to // a NetworkChangeNotifier that lives on another thread. @@ -16,7 +16,7 @@ class MessageLoop; -namespace browser_sync { +namespace chrome_common_net { class NetworkChangeNotifierThread; class NetworkChangeObserverProxy; @@ -66,6 +66,6 @@ class NetworkChangeNotifierProxy : public net::NetworkChangeNotifier { DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierProxy); }; -} // namespace browser_sync +} // namespace chrome_common_net -#endif // CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_NOTIFIER_PROXY_H_ +#endif // CHROME_COMMON_NET_NETWORK_CHANGE_NOTIFIER_PROXY_H_ diff --git a/chrome/browser/sync/net/network_change_notifier_proxy_unittest.cc b/chrome/common/net/network_change_notifier_proxy_unittest.cc index d92e078..a716798 100644 --- a/chrome/browser/sync/net/network_change_notifier_proxy_unittest.cc +++ b/chrome/common/net/network_change_notifier_proxy_unittest.cc @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/network_change_notifier_proxy.h" +#include "chrome/common/net/network_change_notifier_proxy.h" #include "base/basictypes.h" #include "base/logging.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "chrome/browser/sync/net/fake_network_change_notifier_thread.h" -#include "chrome/browser/sync/net/mock_network_change_observer.h" +#include "chrome/common/net/fake_network_change_notifier_thread.h" +#include "chrome/common/net/mock_network_change_observer.h" #include "net/base/network_change_notifier.h" #include "testing/gtest/include/gtest/gtest.h" -namespace browser_sync { +namespace chrome_common_net { namespace { @@ -98,4 +98,4 @@ TEST_F(NetworkChangeNotifierProxyTest, Multiple) { } // namespace -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/network_change_notifier_thread.h b/chrome/common/net/network_change_notifier_thread.h index e7fe375..950186c 100644 --- a/chrome/browser/sync/net/network_change_notifier_thread.h +++ b/chrome/common/net/network_change_notifier_thread.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_NOTIFIER_THREAD_H_ -#define CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_NOTIFIER_THREAD_H_ +#ifndef CHROME_COMMON_NET_NETWORK_CHANGE_NOTIFIER_THREAD_H_ +#define CHROME_COMMON_NET_NETWORK_CHANGE_NOTIFIER_THREAD_H_ // A simple interface that represents a thread which owns a // NetworkChangeNotifier. @@ -14,7 +14,7 @@ namespace net { class NetworkChangeNotifier; } // namespace net -namespace browser_sync { +namespace chrome_common_net { // An instance of this interface must live no longer than the thread // it represents and its message loop and network change notifier. @@ -32,6 +32,6 @@ class NetworkChangeNotifierThread { virtual net::NetworkChangeNotifier* GetNetworkChangeNotifier() const = 0; }; -} // namespace browser_sync +} // namespace chrome_common_net -#endif // CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_NOTIFIER_THREAD_H_ +#endif // CHROME_COMMON_NET_NETWORK_CHANGE_NOTIFIER_THREAD_H_ diff --git a/chrome/browser/sync/net/network_change_observer_proxy.cc b/chrome/common/net/network_change_observer_proxy.cc index 490ba5423..346b06d 100644 --- a/chrome/browser/sync/net/network_change_observer_proxy.cc +++ b/chrome/common/net/network_change_observer_proxy.cc @@ -37,17 +37,17 @@ // RunnableMethods so that the ref-counting guarantees that the // proxy is still valid when the task runs. -#include "chrome/browser/sync/net/network_change_observer_proxy.h" +#include "chrome/common/net/network_change_observer_proxy.h" #include <cstddef> #include "base/logging.h" #include "base/message_loop.h" #include "base/task.h" -#include "chrome/browser/sync/net/network_change_notifier_thread.h" +#include "chrome/common/net/network_change_notifier_thread.h" #include "net/base/network_change_notifier.h" -namespace browser_sync { +namespace chrome_common_net { NetworkChangeObserverProxy::NetworkChangeObserverProxy( const NetworkChangeNotifierThread* source_thread, @@ -135,4 +135,4 @@ void NetworkChangeObserverProxy::TargetObserverOnIPAddressChanged() { } } -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/network_change_observer_proxy.h b/chrome/common/net/network_change_observer_proxy.h index 34374e5..795b0c8 100644 --- a/chrome/browser/sync/net/network_change_observer_proxy.h +++ b/chrome/common/net/network_change_observer_proxy.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_OBSERVER_PROXY_H_ -#define CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_OBSERVER_PROXY_H_ +#ifndef CHROME_COMMON_NET_NETWORK_CHANGE_OBSERVER_PROXY_H_ +#define CHROME_COMMON_NET_NETWORK_CHANGE_OBSERVER_PROXY_H_ // NetworkChangeObserverProxy is a class that listens to a // NetworkChangeNotifier on one thread (the source thread, which is @@ -43,7 +43,7 @@ #include "base/ref_counted.h" #include "net/base/network_change_notifier.h" -namespace browser_sync { +namespace chrome_common_net { class NetworkChangeNotifierThread; @@ -109,6 +109,6 @@ class NetworkChangeObserverProxy DISALLOW_COPY_AND_ASSIGN(NetworkChangeObserverProxy); }; -} // namespace browser_sync +} // namespace chrome_common_net -#endif // CHROME_BROWSER_SYNC_NET_NETWORK_CHANGE_OBSERVER_PROXY_H_ +#endif // CHROME_COMMON_NET_NETWORK_CHANGE_OBSERVER_PROXY_H_ diff --git a/chrome/browser/sync/net/network_change_observer_proxy_unittest.cc b/chrome/common/net/network_change_observer_proxy_unittest.cc index c39184b..0fe3cc1 100644 --- a/chrome/browser/sync/net/network_change_observer_proxy_unittest.cc +++ b/chrome/common/net/network_change_observer_proxy_unittest.cc @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/network_change_observer_proxy.h" +#include "chrome/common/net/network_change_observer_proxy.h" #include "base/basictypes.h" #include "base/logging.h" #include "base/ref_counted.h" -#include "chrome/browser/sync/net/fake_network_change_notifier_thread.h" -#include "chrome/browser/sync/net/mock_network_change_observer.h" +#include "chrome/common/net/fake_network_change_notifier_thread.h" +#include "chrome/common/net/mock_network_change_observer.h" #include "testing/gtest/include/gtest/gtest.h" -namespace browser_sync { +namespace chrome_common_net { namespace { @@ -227,4 +227,4 @@ TEST_F(NetworkChangeObserverProxyTest, IgnoresEventBeforeAttach) { } // namespace -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/thread_blocker.cc b/chrome/common/net/thread_blocker.cc index df3fafc..4ecce8a 100644 --- a/chrome/browser/sync/net/thread_blocker.cc +++ b/chrome/common/net/thread_blocker.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/thread_blocker.h" +#include "chrome/common/net/thread_blocker.h" #include "base/logging.h" #include "base/message_loop.h" @@ -13,12 +13,12 @@ // Since a ThreadBlocker is outlived by its target thread, we don't // have to ref-count it. template <> -struct RunnableMethodTraits<browser_sync::ThreadBlocker> { - void RetainCallee(browser_sync::ThreadBlocker*) {} - void ReleaseCallee(browser_sync::ThreadBlocker*) {} +struct RunnableMethodTraits<chrome_common_net::ThreadBlocker> { + void RetainCallee(chrome_common_net::ThreadBlocker*) {} + void ReleaseCallee(chrome_common_net::ThreadBlocker*) {} }; -namespace browser_sync { +namespace chrome_common_net { ThreadBlocker::ThreadBlocker(base::Thread* target_thread) : target_message_loop_(target_thread->message_loop()), @@ -48,4 +48,4 @@ void ThreadBlocker::BlockOnTargetThread() { is_unblocked_.Signal(); } -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/browser/sync/net/thread_blocker.h b/chrome/common/net/thread_blocker.h index 3548c5d..89ff0d7 100644 --- a/chrome/browser/sync/net/thread_blocker.h +++ b/chrome/common/net/thread_blocker.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_NET_THREAD_BLOCKER_H_ -#define CHROME_BROWSER_SYNC_NET_THREAD_BLOCKER_H_ +#ifndef CHROME_COMMON_NET_THREAD_BLOCKER_H_ +#define CHROME_COMMON_NET_THREAD_BLOCKER_H_ // This class (mainly used for testing) lets you block and unblock a // thread at will. @@ -20,7 +20,7 @@ namespace base { class Thread; } // namespace base -namespace browser_sync { +namespace chrome_common_net { class ThreadBlocker { public: @@ -46,6 +46,6 @@ class ThreadBlocker { DISALLOW_COPY_AND_ASSIGN(ThreadBlocker); }; -} // namespace browser_sync +} // namespace chrome_common_net -#endif // CHROME_BROWSER_SYNC_NET_THREAD_BLOCKER_H_ +#endif // CHROME_COMMON_NET_THREAD_BLOCKER_H_ diff --git a/chrome/browser/sync/net/thread_blocker_unittest.cc b/chrome/common/net/thread_blocker_unittest.cc index 4587e30..1f54482 100644 --- a/chrome/browser/sync/net/thread_blocker_unittest.cc +++ b/chrome/common/net/thread_blocker_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/net/thread_blocker.h" +#include "chrome/common/net/thread_blocker.h" #include "base/basictypes.h" #include "base/lock.h" @@ -13,18 +13,18 @@ #include "base/thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace browser_sync { +namespace chrome_common_net { class Flag; -}; // namespace browser_sync +}; // namespace chrome_common_net -// We manage the lifetime of browser_sync::Flag ourselves. +// We manage the lifetime of chrome_common_net::Flag ourselves. template <> -struct RunnableMethodTraits<browser_sync::Flag> { - void RetainCallee(browser_sync::Flag*) {} - void ReleaseCallee(browser_sync::Flag*) {} +struct RunnableMethodTraits<chrome_common_net::Flag> { + void RetainCallee(chrome_common_net::Flag*) {} + void ReleaseCallee(chrome_common_net::Flag*) {} }; -namespace browser_sync { +namespace chrome_common_net { // Utility class that is basically just a thread-safe boolean. class Flag { @@ -110,4 +110,4 @@ TEST_F(ThreadBlockerTest, SetUnset) { } // namespace -} // namespace browser_sync +} // namespace chrome_common_net diff --git a/chrome/common/net/url_util_unittest.cc b/chrome/common/net/url_util_unittest.cc deleted file mode 100644 index 9462789..0000000 --- a/chrome/common/net/url_util_unittest.cc +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/basictypes.h" -#include "googleurl/src/url_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -TEST(URLUtil, Scheme) { - enum SchemeType { - NO_SCHEME = 0, - SCHEME = 1 << 0, - STANDARD_SCHEME = 1 << 1, - }; - const struct { - const wchar_t* url; - const char* try_scheme; - const bool scheme_matches; - const int flags; - } tests[] = { - {L" ", "hello", false, NO_SCHEME}, - {L"foo", NULL, false, NO_SCHEME}, - {L"google.com/foo:bar", NULL, false, NO_SCHEME}, - {L"Garbage:foo.com", "garbage", true, SCHEME}, - {L"Garbage:foo.com", "trash", false, SCHEME}, - {L"gopher:", "gopher", true, SCHEME | STANDARD_SCHEME}, - {L"About:blank", "about", true, SCHEME}, - {L"http://foo.com:123", "foo", false, SCHEME | STANDARD_SCHEME}, - {L"file://c/", "file", true, SCHEME | STANDARD_SCHEME}, - }; - - for (size_t i = 0; i < arraysize(tests); i++) { - int url_len = static_cast<int>(wcslen(tests[i].url)); - - url_parse::Component parsed_scheme; - bool has_scheme = url_parse::ExtractScheme(tests[i].url, url_len, - &parsed_scheme); - - EXPECT_EQ(!!(tests[i].flags & STANDARD_SCHEME), - url_util::IsStandard(tests[i].url, url_len)); - EXPECT_EQ(!!(tests[i].flags & STANDARD_SCHEME), - url_util::IsStandardScheme(tests[i].url, parsed_scheme.len)); - - url_parse::Component found_scheme; - EXPECT_EQ(tests[i].scheme_matches, - url_util::FindAndCompareScheme(tests[i].url, url_len, - tests[i].try_scheme, - &found_scheme)); - EXPECT_EQ(parsed_scheme.begin, found_scheme.begin); - EXPECT_EQ(parsed_scheme.len, found_scheme.len); - } -} |