summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 18:51:28 +0000
committerdtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 18:51:28 +0000
commit64b59db5208271c0fe9ac18d83a81f0a1ea11768 (patch)
treeb728dad5cc4a91e8da58e23e185d4fa4e19997e0
parent7ba258d3f308c5149e4fe5d8f2e5be44e480721c (diff)
downloadchromium_src-64b59db5208271c0fe9ac18d83a81f0a1ea11768.zip
chromium_src-64b59db5208271c0fe9ac18d83a81f0a1ea11768.tar.gz
chromium_src-64b59db5208271c0fe9ac18d83a81f0a1ea11768.tar.bz2
Revert 84748 - Fix PyAuto Logout() hook. Currently, logging out disconnects the automation channel but does not re-enable Chrome testing.
BUG=chromium-os:14990 TEST=Manual. Tests will be in chromeos_login.py Review URL: http://codereview.chromium.org/6981005 TBR=dtu@chromium.org Review URL: http://codereview.chromium.org/7003004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84828 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sessions/session_restore_uitest.cc4
-rw-r--r--chrome/test/pyautolib/pyauto.py16
-rw-r--r--chrome/test/ui/ui_test.cc13
-rw-r--r--chrome/test/ui/ui_test.h2
4 files changed, 9 insertions, 26 deletions
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index 7b0ffdf..79b1990 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -35,11 +35,13 @@ class SessionRestoreUITest : public UITest {
#if defined(OS_MACOSX)
set_shutdown_type(ProxyLauncher::USER_QUIT);
#endif
+ UITest::TearDown();
+
clear_profile_ = false;
launch_arguments_.AppendSwitchASCII(switches::kRestoreLastSession,
base::IntToString(expected_tab_count));
- ResetConnection();
+ UITest::SetUp();
}
void CloseWindow(int window_index, int initial_count) {
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index be591ed..be9275a 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -277,15 +277,6 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
if item != 'user' and not item.startswith('.'):
pyauto_utils.RemovePath(os.path.join(chronos_dir, item))
- def IsInodeNew(self, old_inode):
- try:
- stat_result = os.stat(self._named_channel_id)
- except OSError:
- return False
- if not stat_result:
- return False
- return stat_result.st_ino != old_inode
-
def RestartBrowser(self, clear_profile=True):
"""Restart the browser.
@@ -2683,11 +2674,10 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
pyauto_errors.JSONInterfaceError if the automation call returns an error.
"""
cmd_dict = { 'command': 'ShowCreateAccountUI' }
- old_inode = os.stat(self._named_channel_id).st_ino
self._GetResultFromJSONRequest(cmd_dict, windex=-1)
# See note below under LoginAsGuest(). ShowCreateAccountUI() essentially
# logs the user in as guest in order to access the account creation page.
- self.WaitUntil(lambda: self.IsInodeNew(old_inode))
+ os.unlink(self._named_channel_id)
self.SetUp()
def LoginAsGuest(self):
@@ -2700,12 +2690,11 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
pyauto_errors.JSONInterfaceError if the automation call returns an error.
"""
cmd_dict = { 'command': 'LoginAsGuest' }
- old_inode = os.stat(self._named_channel_id).st_ino
self._GetResultFromJSONRequest(cmd_dict, windex=-1)
# Currently, logging in as guest causes session_manager to
# restart Chrome, which will close the testing channel.
# We need to call SetUp() again to reconnect to the new channel.
- self.WaitUntil(lambda: self.IsInodeNew(old_inode))
+ os.unlink(self._named_channel_id)
self.SetUp()
def Login(self, username, password):
@@ -2743,7 +2732,6 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
old_pid = pgrep_process.communicate()[0].strip()
self.ApplyAccelerator(IDC_EXIT)
self.WaitUntil(lambda: self.IsSessionManagerReady(old_pid))
- self.setUp()
def LockScreen(self):
"""Locks the screen on chromeos.
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 7da9d1e..c8063c1 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -113,7 +113,10 @@ UITestBase::UITestBase(MessageLoop::Type msg_loop_type)
UITestBase::~UITestBase() {}
void UITestBase::SetUp() {
- launcher_.reset(CreateProxyLauncher());
+ // Some tests (e.g. SessionRestoreUITest) call SetUp() multiple times,
+ // but the ProxyLauncher should be initialized only once per instance.
+ if (!launcher_.get())
+ launcher_.reset(CreateProxyLauncher());
launcher_->AssertAppNotRunning(L"Please close any other instances "
L"of the app before testing.");
@@ -157,14 +160,6 @@ void UITestBase::TearDown() {
EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg;
}
-void UITestBase::ResetConnection() {
- if (launcher_.get()) {
- launcher_->TerminateConnection();
- launcher_->InitializeConnection(DefaultLaunchState(),
- wait_for_initial_loads_);
- }
-}
-
int UITestBase::action_timeout_ms() {
return automation()->action_timeout_ms();
}
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index db19b6f..62b101d 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -264,8 +264,6 @@ class UITestBase {
// Closes the browser window.
virtual void TearDown();
- void ResetConnection();
-
AutomationProxy* automation() const {
return launcher_->automation();
}