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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py

Issue 2141093006: In Linux Port, make a dummy HOME directory for running tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test and add expand comments. Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
index 1f802d822743f20e9ff6b5f18b5b65922e8ba8cd..c14803152a39946d9a83aa289ea79159dfe6c843 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
@@ -26,13 +26,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import os
from webkitpy.common.system import executive_mock
from webkitpy.common.system.systemhost_mock import MockSystemHost
-from webkitpy.tool.mock_tool import MockOptions
-
from webkitpy.layout_tests.port import linux
from webkitpy.layout_tests.port import port_testcase
+from webkitpy.tool.mock_tool import MockOptions
class LinuxPortTest(port_testcase.PortTestCase):
@@ -42,6 +42,13 @@ class LinuxPortTest(port_testcase.PortTestCase):
full_port_name = 'linux-trusty'
port_maker = linux.LinuxPort
+ def setUp(self):
+ # TODO(qyearsley): Remove this when crbug.com/627887 is fixed.
+ self.original_environ = os.environ.copy()
+
+ def tearDown(self):
+ os.environ = self.original_environ
+
def assert_version_properties(self, port_name, os_version, expected_name,
expected_version,
driver_file_output=None):
@@ -101,3 +108,21 @@ class LinuxPortTest(port_testcase.PortTestCase):
def test_path_to_image_diff(self):
self.assertEqual(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/image_diff')
+
+ def test_dummy_home_dir_is_created_and_cleaned_up(self):
+ original_home = '/home/user'
+ os.environ['HOME'] = original_home
+ port = self.make_port()
+ port._filesystem.files['/home/user/.Xauthority'] = ''
+
+ # Set up the test run; the temporary home directory should be set up.
+ port.setup_test_run()
+ temp_home_dir = os.environ['HOME']
+ self.assertNotEqual(temp_home_dir, original_home)
+ self.assertTrue(port._filesystem.isdir(temp_home_dir))
+ self.assertTrue(port._filesystem.isfile(port._filesystem.join(temp_home_dir, '.Xauthority')))
+
+ # Clean up; HOME should be reset and the temp dir should be cleaned up.
+ port.clean_up_test_run()
+ self.assertEqual(os.environ.get('HOME'), original_home)
+ self.assertFalse(port._filesystem.exists(temp_home_dir))
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698