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

Unified Diff: platform_tools/android/tests/utils.py

Issue 198063002: Updates to Android.mk generation. (Closed) Base URL: https://skia.googlesource.com/skia.git@android_mk
Patch Set: Add a comment explaining the motivation of OrderedSet. Created 6 years, 9 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 | « platform_tools/android/tests/ordered_set_tests.py ('k') | platform_tools/android/tests/var_dict_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform_tools/android/tests/utils.py
diff --git a/platform_tools/android/tests/utils.py b/platform_tools/android/tests/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..0a969964b5d9e3b633b4198f681e79964146a3c1
--- /dev/null
+++ b/platform_tools/android/tests/utils.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+# Copyright 2014 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Common code for tests.
+"""
+import filecmp
+import os
+
+EXPECTATIONS_DIR = os.path.join(os.path.dirname(__file__), 'expectations')
+
+def compare_to_expectation(actual_name, expectation_name, assert_true,
+ msg=None):
+ """Check that a generated file matches its expectation in EXPECTATIONS_DIR.
+
+ Assert that the generated file and expectation file are identical.
+
+ Args:
+ actual_name: Full path to the test file.
+ expectation_name: Basename of the expectations file within which
+ to compare. The file is expected to be in
+ platform_tools/android/tests/expectations.
+ assert_true: function for asserting a statement is True
+
+ Args:
+ condition: statement to check for True.
+ msg: message to print if the files are not equal.
+
+ msg: Message to pass to assert_true.
+ """
+ full_expectations_path = os.path.join(EXPECTATIONS_DIR, expectation_name)
+ assert_true(filecmp.cmp(actual_name, full_expectations_path), msg)
« no previous file with comments | « platform_tools/android/tests/ordered_set_tests.py ('k') | platform_tools/android/tests/var_dict_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698