summaryrefslogtreecommitdiffstats
path: root/chrome/test/live_sync
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-15 22:28:18 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-15 22:28:18 +0000
commit20d241c33c3e6c1be8ab4023dfa46d6a4fdb4766 (patch)
treeeabbd6105323cfff531bf12d92feeccaa9f6fe40 /chrome/test/live_sync
parent9aae0f1396b3a9f6c228326b3770c94e741b1bd9 (diff)
downloadchromium_src-20d241c33c3e6c1be8ab4023dfa46d6a4fdb4766.zip
chromium_src-20d241c33c3e6c1be8ab4023dfa46d6a4fdb4766.tar.gz
chromium_src-20d241c33c3e6c1be8ab4023dfa46d6a4fdb4766.tar.bz2
Revert 44708 - Python implementation of sync server, for testing.
Implement the server side of chromium sync inside of testserver.py. The implementation supports at most one account (and ignores authentication credentials), but is otherwise reasonably full featured. Make the sync_integration_tests run by default against the test server. An externallyprovided syncurl will give the old behavior. Protocol buffers stuff: The test sync server requires Python generated code for .proto files. I've put generated code, as well as the python protocol buffers runtime library, in the output directory + "/python" (e.g, on windows, src/chrome/Debug/python/google/protobuf). This might be a bad place, or a bad name open to suggestions. The main thing is that there will be runtime dependencies on it, so it didn't seem right to put it in obj/. Flakiness fix: In the InProcessBrowserTest framework, improve the mechanism for tests that want to manually set up a user data directory. The new way ensures that the user data directory is always wiped; tests can't accidentally forget to do this anymore. Flakiness fix: Make testserver try to /kill any old instance that might be hogging the port. Very useful if a test failure leaves a server running. Tested this against all combos of protocols, and it seems to work. Flakiness fix: Port sync_integration_tests to the outofprocess test runner. Flakiness fix: For IN_PROC_BROWSER_TESTS, don't run the test body if the setup triggered a fatal (ASSERT_) failure. BUG=20905,40980 Review URL: http://codereview.chromium.org/1622012 TBR=nick@chromium.org Review URL: http://codereview.chromium.org/1633015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/live_sync')
-rw-r--r--chrome/test/live_sync/live_sync_test.h23
-rw-r--r--chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc42
2 files changed, 24 insertions, 41 deletions
diff --git a/chrome/test/live_sync/live_sync_test.h b/chrome/test/live_sync/live_sync_test.h
index ec8a5c6..43975f6 100644
--- a/chrome/test/live_sync/live_sync_test.h
+++ b/chrome/test/live_sync/live_sync_test.h
@@ -12,7 +12,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/in_process_browser_test.h"
#include "googleurl/src/gurl.h"
-#include "net/socket/ssl_test_util.h"
class BookmarkModel;
class BookmarkNode;
@@ -46,30 +45,10 @@ class LiveSyncTest : public InProcessBrowserTest {
ASSERT_FALSE(password_.empty()) << "Can't run live server test "
<< "without specifying --" << switches::kSyncPasswordForTest;
- // Unless a sync server was explicitly provided, run a test one locally.
- // TODO(ncarter): It might be better to allow the user to specify a choice
- // of sync server "providers" -- a script that could locate (or allocate)
- // a sync server instance, possibly on some remote host. The provider
- // would be invoked before each test.
- if (!cl->HasSwitch(switches::kSyncServiceURL))
- SetUpLocalTestServer();
-
// Yield control back to the InProcessBrowserTest framework.
InProcessBrowserTest::SetUp();
}
- virtual void SetUpLocalTestServer() {
- bool success = server_.Start(net::TestServerLauncher::ProtoHTTP,
- server_.kHostName, server_.kOKHTTPSPort,
- FilePath(), FilePath(), std::wstring());
- ASSERT_TRUE(success);
-
- CommandLine* cl = CommandLine::ForCurrentProcess();
- cl->AppendSwitchWithValue(switches::kSyncServiceURL,
- StringPrintf("http://%s:%d/chromiumsync", server_.kHostName,
- server_.kOKHTTPSPort));
- }
-
// Append command line flag to enable sync.
virtual void SetUpCommandLine(CommandLine* command_line) {
}
@@ -99,8 +78,6 @@ class LiveSyncTest : public InProcessBrowserTest {
// to override the default resolver while the test is active.
scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_;
- net::TestServerLauncher server_;
-
DISALLOW_COPY_AND_ASSIGN(LiveSyncTest);
};
diff --git a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc
index 9e7ff03..bfae3c7 100644
--- a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc
+++ b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc
@@ -50,6 +50,11 @@ class TwoClientLiveBookmarksSyncTest : public LiveSyncTest {
}
}
+ // Overwrites ShouldDeleteProfile, so profile doesn't get deleted.
+ virtual bool ShouldDeleteProfile() {
+ return false;
+ }
+
// Overload this method in inherited class and return false to avoid
// race condition (two clients trying to sync/commit at the same time).
// Race condition may lead to duplicate bookmarks if there is existing
@@ -89,8 +94,7 @@ class TwoClientLiveBookmarksSyncTest : public LiveSyncTest {
FILE_PATH_LITERAL("live_sync_data"));
FilePath source_file = sync_data_source.Append(
bookmarks_file_name);
- ASSERT_TRUE(file_util::PathExists(source_file))
- << "Could not locate test data file: " << source_file.value();
+ ASSERT_TRUE(file_util::PathExists(source_file));
// Now copy pre-generated bookmark file to default profile.
ASSERT_TRUE(file_util::CopyFile(source_file,
dest_user_data_dir_default.Append(FILE_PATH_LITERAL("bookmarks"))));
@@ -147,10 +151,9 @@ class LiveSyncTestPrePopulatedHistory1K
LiveSyncTestPrePopulatedHistory1K() {}
virtual ~LiveSyncTestPrePopulatedHistory1K() {}
- // This is used to pre-populate history data (1K URL Visit) to Client1
- // and Verifier Client. Invoked by InProcBrowserTest::SetUp before
- // the browser is started.
- virtual void SetUpUserDataDirectory() {
+ // This is used to pre-populate history data (1K URL Visit)to Client1
+ // and Verifier Client.
+ void PrePopulateHistory1K() {
// Let's copy history files to default profile.
FilePath dest_user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &dest_user_data_dir);
@@ -179,6 +182,11 @@ class LiveSyncTestPrePopulatedHistory1K
}
}
+ virtual void SetUp() {
+ PrePopulateHistory1K();
+ LiveSyncTest::SetUp();
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(LiveSyncTestPrePopulatedHistory1K);
};
@@ -189,10 +197,10 @@ class LiveSyncTestBasicHierarchy50BM
LiveSyncTestBasicHierarchy50BM() {}
virtual ~LiveSyncTestBasicHierarchy50BM() {}
- // Invoked by InProcBrowserTest::SetUp before the browser is started.
- virtual void SetUpUserDataDirectory() {
+ virtual void SetUp() {
FilePath file_name(FILE_PATH_LITERAL("bookmarks_50BM5F3L"));
PrePopulateBookmarksHierarchy(file_name);
+ LiveSyncTest::SetUp();
}
private:
@@ -225,11 +233,10 @@ class LiveSyncTestComplexHierarchy800BM
public:
LiveSyncTestComplexHierarchy800BM() {}
virtual ~LiveSyncTestComplexHierarchy800BM() {}
-
- // Invoked by InProcBrowserTest::SetUp before the browser is started.
- virtual void SetUpUserDataDirectory() {
+ virtual void SetUp() {
FilePath file_name(FILE_PATH_LITERAL("bookmarks_800BM32F8L"));
- PrePopulateBookmarksHierarchy(file_name);
+ TwoClientLiveBookmarksSyncTest::PrePopulateBookmarksHierarchy(file_name);
+ LiveSyncTest::SetUp();
}
private:
@@ -241,11 +248,10 @@ class LiveSyncTestHugeHierarchy5500BM
public:
LiveSyncTestHugeHierarchy5500BM() {}
virtual ~LiveSyncTestHugeHierarchy5500BM() {}
-
- // Invoked by InProcBrowserTest::SetUp before the browser is started.
- virtual void SetUpUserDataDirectory() {
+ virtual void SetUp() {
FilePath file_name(FILE_PATH_LITERAL("bookmarks_5500BM125F25L"));
- PrePopulateBookmarksHierarchy(file_name);
+ TwoClientLiveBookmarksSyncTest::PrePopulateBookmarksHierarchy(file_name);
+ LiveSyncTest::SetUp();
}
virtual bool ShouldSetupSyncWithRace() {
return false;
@@ -261,11 +267,11 @@ class LiveSyncTestDefaultIEFavorites
LiveSyncTestDefaultIEFavorites() {}
virtual ~LiveSyncTestDefaultIEFavorites() {}
- // Invoked by InProcBrowserTest::SetUp before the browser is started.
- virtual void SetUpUserDataDirectory() {
+ virtual void SetUp() {
const FilePath file_name(
FILE_PATH_LITERAL("bookmarks_default_IE_favorites"));
TwoClientLiveBookmarksSyncTest::PrePopulateBookmarksHierarchy(file_name);
+ LiveSyncTest::SetUp();
}
private: