summaryrefslogtreecommitdiffstats
path: root/chrome/test/live_sync/live_sync_test.h
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 05:37:51 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 05:37:51 +0000
commit0a5893a88936f38cbf8646ed7a06f1c19a289341 (patch)
tree9050702c471c07e9be64d46d69d00589ab8dae3f /chrome/test/live_sync/live_sync_test.h
parent651fac9f29ca8450e6879b26faf0b1146164b24a (diff)
downloadchromium_src-0a5893a88936f38cbf8646ed7a06f1c19a289341.zip
chromium_src-0a5893a88936f38cbf8646ed7a06f1c19a289341.tar.gz
chromium_src-0a5893a88936f38cbf8646ed7a06f1c19a289341.tar.bz2
[Third time landing] 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 externally-provided --sync-url 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). 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 out-of-process 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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=44708 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=45916 Review URL: http://codereview.chromium.org/1622012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/live_sync/live_sync_test.h')
-rw-r--r--chrome/test/live_sync/live_sync_test.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/test/live_sync/live_sync_test.h b/chrome/test/live_sync/live_sync_test.h
index 9fd3373..cb11795 100644
--- a/chrome/test/live_sync/live_sync_test.h
+++ b/chrome/test/live_sync/live_sync_test.h
@@ -12,6 +12,7 @@
#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;
@@ -45,10 +46,30 @@ 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) {
}
@@ -78,6 +99,8 @@ 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);
};