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

Unified Diff: tools/telemetry/telemetry/core/util_unittest.py

Issue 625123002: Make credential_path a page attribute instead of page_set attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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
Index: tools/telemetry/telemetry/core/util_unittest.py
diff --git a/tools/telemetry/telemetry/core/util_unittest.py b/tools/telemetry/telemetry/core/util_unittest.py
index 15a1aaff4a40c7d39a05bc38dc1c93996d0cc4de..a48aef0a30c36f0e87827eca844699e3799af0ab 100644
--- a/tools/telemetry/telemetry/core/util_unittest.py
+++ b/tools/telemetry/telemetry/core/util_unittest.py
@@ -62,3 +62,36 @@ class TestGetSequentialFileName(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.test_directory)
+
+
+class TestGetAbsPathIfExists(unittest.TestCase):
+ def setUp(self):
+ self.test_directory = tempfile.mkdtemp()
+ self.test_abs_path = tempfile.mkstemp(dir=self.test_directory)[1]
+
+ def testTestGetAbsPathIfExistsWithExistedAbsPathInput(self):
+ self.assertEquals(
+ self.test_abs_path, util.GetAbsPathIfExist(
+ self.test_abs_path, self.test_directory))
+
+ def testTestGetAbsPathIfExistsWithExistedRelativePathInput(self):
+ # Case path = foo and relative path = /tmp/xyz/
+ # (The actual naming maybe different)
+ path = os.path.basename(self.test_abs_path)
+ relative_path = self.test_directory
+ self.assertEquals(
+ self.test_abs_path, util.GetAbsPathIfExist(path, relative_path))
+ # Case path = xyz/foo and relative path = /tmp/
+ # (The actual naming maybe different)
+ path = os.path.join(os.path.basename(self.test_directory),
+ os.path.basename(self.test_abs_path))
+ relative_path = os.path.join(self.test_directory, os.pardir)
+ self.assertEquals(
+ self.test_abs_path, util.GetAbsPathIfExist(path, relative_path))
+
+ def testTestGetAbsPathIfExistsWithNonExistedPathInput(self):
+ self.assertIsNone(util.GetAbsPathIfExist('foo', self.test_directory))
+ self.assertIsNone(util.GetAbsPathIfExist('foo/bar', self.test_directory))
+
+ def tearDown(self):
+ shutil.rmtree(self.test_directory)

Powered by Google App Engine
This is Rietveld 408576698