diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-28 01:51:56 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-28 01:51:56 +0000 |
commit | e7abd23a5baa4907b0f90e89ec6e13cc872eb59d (patch) | |
tree | 345e5721acd6ef3a72ebad7640bdb536e6bfedbc /chrome/test/live_sync | |
parent | d2416e00860d6810830c3c3749aad639026c84a3 (diff) | |
download | chromium_src-e7abd23a5baa4907b0f90e89ec6e13cc872eb59d.zip chromium_src-e7abd23a5baa4907b0f90e89ec6e13cc872eb59d.tar.gz chromium_src-e7abd23a5baa4907b0f90e89ec6e13cc872eb59d.tar.bz2 |
Adding a TearDown() method to class LiveSyncTest.
The LiveSyncTest class derives from InProcessBrowserTest and overrides
the SetUp method to account for the case when a local sync server needs
to be started. However, there isn't a corresponding override for the
TearDown method that stops the local sync server. This changelist adds
an overload for TearDown that stops the local sync server if one was
started in SetUp.
BUG=45181
TEST=sync_integration_tests
Review URL: http://codereview.chromium.org/2260001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/live_sync')
-rw-r--r-- | chrome/test/live_sync/live_sync_test.cc | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/test/live_sync/live_sync_test.h | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc index 3fc7104..7cf2e94 100644 --- a/chrome/test/live_sync/live_sync_test.cc +++ b/chrome/test/live_sync/live_sync_test.cc @@ -53,7 +53,7 @@ class BookmarkLoadObserver : public BookmarkModelObserver { DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver); }; -LiveSyncTest::LiveSyncTest() { +LiveSyncTest::LiveSyncTest() : started_local_test_server_(false) { } LiveSyncTest::~LiveSyncTest() { diff --git a/chrome/test/live_sync/live_sync_test.h b/chrome/test/live_sync/live_sync_test.h index cb11795..a9366eb 100644..100755 --- a/chrome/test/live_sync/live_sync_test.h +++ b/chrome/test/live_sync/live_sync_test.h @@ -58,18 +58,34 @@ class LiveSyncTest : public InProcessBrowserTest { InProcessBrowserTest::SetUp(); } + virtual void TearDown() { + // Allow the InProcessBrowserTest framework to perform its tear down. + InProcessBrowserTest::TearDown(); + + // Stop the local test sync server if one was used. + if (started_local_test_server_) + TearDownLocalTestServer(); + } + virtual void SetUpLocalTestServer() { bool success = server_.Start(net::TestServerLauncher::ProtoHTTP, server_.kHostName, server_.kOKHTTPSPort, FilePath(), FilePath(), std::wstring()); ASSERT_TRUE(success); + started_local_test_server_ = true; + CommandLine* cl = CommandLine::ForCurrentProcess(); cl->AppendSwitchWithValue(switches::kSyncServiceURL, StringPrintf("http://%s:%d/chromiumsync", server_.kHostName, server_.kOKHTTPSPort)); } + virtual void TearDownLocalTestServer() { + bool success = server_.Stop(); + ASSERT_TRUE(success); + } + // Append command line flag to enable sync. virtual void SetUpCommandLine(CommandLine* command_line) { } @@ -100,6 +116,7 @@ class LiveSyncTest : public InProcessBrowserTest { scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_; net::TestServerLauncher server_; + bool started_local_test_server_; DISALLOW_COPY_AND_ASSIGN(LiveSyncTest); }; |