Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2571)

Unified Diff: chrome/browser/sync/test/integration/sync_test.cc

Issue 7841007: Rename browser/sync/test/live_sync directory to browser/sync/test/integration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/sync_test.cc
diff --git a/chrome/browser/sync/test/live_sync/live_sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
similarity index 88%
rename from chrome/browser/sync/test/live_sync/live_sync_test.cc
rename to chrome/browser/sync/test/integration/sync_test.cc
index d47f34e4a0ade8726ea6107067f483f604a4a3ff..aa0ebbd4a9411174cf906a9137d678b5b8a89d45 100644
--- a/chrome/browser/sync/test/live_sync/live_sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.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/test/live_sync/live_sync_test.h"
+#include "chrome/browser/sync/test/integration/sync_test.h"
#include <vector>
@@ -23,7 +23,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/notifier/p2p_notifier.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
-#include "chrome/browser/sync/test/live_sync/sync_datatype_helper.h"
+#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_paths.h"
@@ -108,7 +108,7 @@ class SetProxyConfigTask : public Task {
net::ProxyConfig proxy_config_;
};
-LiveSyncTest::LiveSyncTest(TestType test_type)
+SyncTest::SyncTest(TestType test_type)
: sync_server_(net::TestServer::TYPE_SYNC, FilePath()),
test_type_(test_type),
server_type_(SERVER_TYPE_UNDECIDED),
@@ -137,9 +137,9 @@ LiveSyncTest::LiveSyncTest(TestType test_type)
}
}
-LiveSyncTest::~LiveSyncTest() {}
+SyncTest::~SyncTest() {}
-void LiveSyncTest::SetUp() {
+void SyncTest::SetUp() {
CommandLine* cl = CommandLine::ForCurrentProcess();
if (cl->HasSwitch(switches::kPasswordFileForTest)) {
ReadPasswordFile();
@@ -153,13 +153,13 @@ void LiveSyncTest::SetUp() {
if (!cl->HasSwitch(switches::kSyncServiceURL) &&
!cl->HasSwitch(switches::kSyncServerCommandLine)) {
- // If neither a sync server URL nor a sync server command line is
- // provided, start up a local python sync test server and point Chrome
- // to its URL. This is the most common configuration, and the only
- // one that makes sense for most developers.
- server_type_ = LOCAL_PYTHON_SERVER;
+ // If neither a sync server URL nor a sync server command line is
+ // provided, start up a local python sync test server and point Chrome
+ // to its URL. This is the most common configuration, and the only
+ // one that makes sense for most developers.
+ server_type_ = LOCAL_PYTHON_SERVER;
} else if (cl->HasSwitch(switches::kSyncServiceURL) &&
- cl->HasSwitch(switches::kSyncServerCommandLine)) {
+ cl->HasSwitch(switches::kSyncServerCommandLine)) {
// If a sync server URL and a sync server command line are provided,
// start up a local sync server by running the command line. Chrome
// will connect to the server at the URL that was provided.
@@ -189,7 +189,7 @@ void LiveSyncTest::SetUp() {
InProcessBrowserTest::SetUp();
}
-void LiveSyncTest::TearDown() {
+void SyncTest::TearDown() {
// Allow the InProcessBrowserTest framework to perform its tear down.
InProcessBrowserTest::TearDown();
@@ -200,12 +200,12 @@ void LiveSyncTest::TearDown() {
TearDownLocalTestServer();
}
-void LiveSyncTest::SetUpCommandLine(CommandLine* cl) {
+void SyncTest::SetUpCommandLine(CommandLine* cl) {
AddTestSwitches(cl);
AddOptionalTypesToCommandLine(cl);
}
-void LiveSyncTest::AddTestSwitches(CommandLine* cl) {
+void SyncTest::AddTestSwitches(CommandLine* cl) {
// TODO(rsimha): Until we implement a fake Tango server against which tests
// can run, we need to set the --sync-notification-method to "p2p".
if (!cl->HasSwitch(switches::kSyncNotificationMethod))
@@ -216,14 +216,14 @@ void LiveSyncTest::AddTestSwitches(CommandLine* cl) {
cl->AppendSwitch(switches::kDisableBackgroundNetworking);
}
-void LiveSyncTest::AddOptionalTypesToCommandLine(CommandLine* cl) {
+void SyncTest::AddOptionalTypesToCommandLine(CommandLine* cl) {
// TODO(sync): Remove this once sessions sync is enabled by default.
if (!cl->HasSwitch(switches::kEnableSyncSessions))
cl->AppendSwitch(switches::kEnableSyncSessions);
}
// static
-Profile* LiveSyncTest::MakeProfile(const FilePath::StringType name) {
+Profile* SyncTest::MakeProfile(const FilePath::StringType name) {
FilePath path;
PathService::Get(chrome::DIR_USER_DATA, &path);
path = path.Append(name);
@@ -234,7 +234,7 @@ Profile* LiveSyncTest::MakeProfile(const FilePath::StringType name) {
return Profile::CreateProfile(path);
}
-Profile* LiveSyncTest::GetProfile(int index) {
+Profile* SyncTest::GetProfile(int index) {
if (profiles_.empty())
LOG(FATAL) << "SetupClients() has not yet been called.";
if (index < 0 || index >= static_cast<int>(profiles_.size()))
@@ -242,7 +242,7 @@ Profile* LiveSyncTest::GetProfile(int index) {
return profiles_[index];
}
-Browser* LiveSyncTest::GetBrowser(int index) {
+Browser* SyncTest::GetBrowser(int index) {
if (browsers_.empty())
LOG(FATAL) << "SetupClients() has not yet been called.";
if (index < 0 || index >= static_cast<int>(browsers_.size()))
@@ -250,7 +250,7 @@ Browser* LiveSyncTest::GetBrowser(int index) {
return browsers_[index];
}
-ProfileSyncServiceHarness* LiveSyncTest::GetClient(int index) {
+ProfileSyncServiceHarness* SyncTest::GetClient(int index) {
if (clients_.empty())
LOG(FATAL) << "SetupClients() has not yet been called.";
if (index < 0 || index >= static_cast<int>(clients_.size()))
@@ -258,17 +258,17 @@ ProfileSyncServiceHarness* LiveSyncTest::GetClient(int index) {
return clients_[index];
}
-Profile* LiveSyncTest::verifier() {
+Profile* SyncTest::verifier() {
if (verifier_.get() == NULL)
LOG(FATAL) << "SetupClients() has not yet been called.";
return verifier_.get();
}
-void LiveSyncTest::DisableVerifier() {
+void SyncTest::DisableVerifier() {
use_verifier_ = false;
}
-bool LiveSyncTest::SetupClients() {
+bool SyncTest::SetupClients() {
if (num_clients_ <= 0)
LOG(FATAL) << "num_clients_ incorrectly initialized.";
if (!profiles_.empty() || !browsers_.empty() || !clients_.empty())
@@ -300,7 +300,7 @@ bool LiveSyncTest::SetupClients() {
return (verifier_.get() != NULL);
}
-bool LiveSyncTest::SetupSync() {
+bool SyncTest::SetupSync() {
// Create sync profiles and clients if they haven't already been created.
if (profiles_.empty()) {
if (!SetupClients())
@@ -316,7 +316,7 @@ bool LiveSyncTest::SetupSync() {
return true;
}
-void LiveSyncTest::CleanUpOnMainThread() {
+void SyncTest::CleanUpOnMainThread() {
// Close all browser windows.
BrowserList::CloseAllBrowsers();
ui_test_utils::RunAllPendingInMessageLoop();
@@ -330,7 +330,7 @@ void LiveSyncTest::CleanUpOnMainThread() {
verifier_.reset(NULL);
}
-void LiveSyncTest::SetUpInProcessBrowserTestFixture() {
+void SyncTest::SetUpInProcessBrowserTestFixture() {
// We don't take a reference to |resolver|, but mock_host_resolver_override_
// does, so effectively assumes ownership.
net::RuleBasedHostResolverProc* resolver =
@@ -346,11 +346,11 @@ void LiveSyncTest::SetUpInProcessBrowserTestFixture() {
new net::ScopedDefaultHostResolverProc(resolver));
}
-void LiveSyncTest::TearDownInProcessBrowserTestFixture() {
+void SyncTest::TearDownInProcessBrowserTestFixture() {
mock_host_resolver_override_.reset();
}
-void LiveSyncTest::ReadPasswordFile() {
+void SyncTest::ReadPasswordFile() {
CommandLine* cl = CommandLine::ForCurrentProcess();
password_file_ = cl->GetSwitchValuePath(switches::kPasswordFileForTest);
if (password_file_.empty())
@@ -370,7 +370,7 @@ void LiveSyncTest::ReadPasswordFile() {
password_ = tokens[1];
}
-void LiveSyncTest::SetupMockGaiaResponses() {
+void SyncTest::SetupMockGaiaResponses() {
username_ = "user@gmail.com";
password_ = "password";
factory_.reset(new URLFetcherFactory());
@@ -383,7 +383,7 @@ void LiveSyncTest::SetupMockGaiaResponses() {
// Start up a local sync server based on the value of server_type_, which
// was determined from the command line parameters.
-void LiveSyncTest::SetUpTestServerIfRequired() {
+void SyncTest::SetUpTestServerIfRequired() {
if (server_type_ == LOCAL_PYTHON_SERVER) {
if (!SetUpLocalPythonTestServer())
LOG(FATAL) << "Failed to set up local python sync and XMPP servers";
@@ -400,7 +400,7 @@ void LiveSyncTest::SetUpTestServerIfRequired() {
}
}
-bool LiveSyncTest::SetUpLocalPythonTestServer() {
+bool SyncTest::SetUpLocalPythonTestServer() {
EXPECT_TRUE(sync_server_.Start())
<< "Could not launch local python test server.";
@@ -437,7 +437,7 @@ bool LiveSyncTest::SetUpLocalPythonTestServer() {
return true;
}
-bool LiveSyncTest::SetUpLocalTestServer() {
+bool SyncTest::SetUpLocalTestServer() {
CommandLine* cl = CommandLine::ForCurrentProcess();
CommandLine::StringType server_cmdline_string = cl->GetSwitchValueNative(
switches::kSyncServerCommandLine);
@@ -465,7 +465,7 @@ bool LiveSyncTest::SetUpLocalTestServer() {
}
}
-bool LiveSyncTest::TearDownLocalPythonTestServer() {
+bool SyncTest::TearDownLocalPythonTestServer() {
if (!sync_server_.Stop()) {
LOG(ERROR) << "Could not stop local python test server.";
return false;
@@ -474,7 +474,7 @@ bool LiveSyncTest::TearDownLocalPythonTestServer() {
return true;
}
-bool LiveSyncTest::TearDownLocalTestServer() {
+bool SyncTest::TearDownLocalTestServer() {
if (test_server_handle_ != base::kNullProcessHandle) {
EXPECT_TRUE(base::KillProcess(test_server_handle_, 0, false))
<< "Could not stop local test server.";
@@ -484,7 +484,7 @@ bool LiveSyncTest::TearDownLocalTestServer() {
return true;
}
-bool LiveSyncTest::WaitForTestServerToStart(int time_ms, int intervals) {
+bool SyncTest::WaitForTestServerToStart(int time_ms, int intervals) {
for (int i = 0; i < intervals; ++i) {
if (IsTestServerRunning())
return true;
@@ -493,7 +493,7 @@ bool LiveSyncTest::WaitForTestServerToStart(int time_ms, int intervals) {
return false;
}
-bool LiveSyncTest::IsTestServerRunning() {
+bool SyncTest::IsTestServerRunning() {
CommandLine* cl = CommandLine::ForCurrentProcess();
std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL);
GURL sync_url_status(sync_url.append("/healthz"));
@@ -505,14 +505,14 @@ bool LiveSyncTest::IsTestServerRunning() {
return delegate.running();
}
-void LiveSyncTest::EnableNetwork(Profile* profile) {
+void SyncTest::EnableNetwork(Profile* profile) {
SetProxyConfig(profile->GetRequestContext(),
net::ProxyConfig::CreateDirect());
// TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed.
net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
}
-void LiveSyncTest::DisableNetwork(Profile* profile) {
+void SyncTest::DisableNetwork(Profile* profile) {
// Set the current proxy configuration to a nonexistent proxy to effectively
// disable networking.
net::ProxyConfig config;
@@ -522,26 +522,26 @@ void LiveSyncTest::DisableNetwork(Profile* profile) {
net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
}
-bool LiveSyncTest::EnableEncryption(int index, syncable::ModelType type) {
+bool SyncTest::EnableEncryption(int index, syncable::ModelType type) {
return GetClient(index)->EnableEncryptionForType(type);
}
-bool LiveSyncTest::IsEncrypted(int index, syncable::ModelType type) {
+bool SyncTest::IsEncrypted(int index, syncable::ModelType type) {
return GetClient(index)->IsTypeEncrypted(type);
}
-bool LiveSyncTest::AwaitQuiescence() {
+bool SyncTest::AwaitQuiescence() {
return ProfileSyncServiceHarness::AwaitQuiescence(clients());
}
-bool LiveSyncTest::ServerSupportsNotificationControl() const {
+bool SyncTest::ServerSupportsNotificationControl() const {
EXPECT_NE(SERVER_TYPE_UNDECIDED, server_type_);
// Supported only if we're using the python testserver.
return server_type_ == LOCAL_PYTHON_SERVER;
}
-void LiveSyncTest::DisableNotifications() {
+void SyncTest::DisableNotifications() {
ASSERT_TRUE(ServerSupportsNotificationControl());
std::string path = "chromiumsync/disablenotifications";
ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
@@ -549,7 +549,7 @@ void LiveSyncTest::DisableNotifications() {
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-void LiveSyncTest::EnableNotifications() {
+void SyncTest::EnableNotifications() {
ASSERT_TRUE(ServerSupportsNotificationControl());
std::string path = "chromiumsync/enablenotifications";
ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
@@ -557,7 +557,7 @@ void LiveSyncTest::EnableNotifications() {
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-void LiveSyncTest::TriggerNotification(
+void SyncTest::TriggerNotification(
const syncable::ModelTypeSet& changed_types) {
ASSERT_TRUE(ServerSupportsNotificationControl());
const std::string& data =
@@ -572,14 +572,14 @@ void LiveSyncTest::TriggerNotification(
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-bool LiveSyncTest::ServerSupportsErrorTriggering() const {
+bool SyncTest::ServerSupportsErrorTriggering() const {
EXPECT_NE(SERVER_TYPE_UNDECIDED, server_type_);
// Supported only if we're using the python testserver.
return server_type_ == LOCAL_PYTHON_SERVER;
}
-void LiveSyncTest::TriggerMigrationDoneError(
+void SyncTest::TriggerMigrationDoneError(
const syncable::ModelTypeSet& model_types) {
ASSERT_TRUE(ServerSupportsErrorTriggering());
std::string path = "chromiumsync/migrate";
@@ -595,7 +595,7 @@ void LiveSyncTest::TriggerMigrationDoneError(
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-void LiveSyncTest::TriggerBirthdayError() {
+void SyncTest::TriggerBirthdayError() {
ASSERT_TRUE(ServerSupportsErrorTriggering());
std::string path = "chromiumsync/birthdayerror";
ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
@@ -603,7 +603,7 @@ void LiveSyncTest::TriggerBirthdayError() {
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-void LiveSyncTest::TriggerTransientError() {
+void SyncTest::TriggerTransientError() {
ASSERT_TRUE(ServerSupportsErrorTriggering());
std::string path = "chromiumsync/transienterror";
ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
@@ -611,7 +611,7 @@ void LiveSyncTest::TriggerTransientError() {
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-void LiveSyncTest::TriggerSetSyncTabs() {
+void SyncTest::TriggerSetSyncTabs() {
ASSERT_TRUE(ServerSupportsErrorTriggering());
std::string path = "chromiumsync/synctabs";
ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
@@ -619,8 +619,8 @@ void LiveSyncTest::TriggerSetSyncTabs() {
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
-void LiveSyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter,
- const net::ProxyConfig& proxy_config) {
+void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter,
+ const net::ProxyConfig& proxy_config) {
base::WaitableEvent done(false, false);
BrowserThread::PostTask(
BrowserThread::IO,
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | chrome/browser/sync/test/integration/themes_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698