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

Unified Diff: build/android/pylib/linker/test_case.py

Issue 59033008: android: Make org.chromium.base.SysUtils.isLowEndDevice() work without native code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 7 years, 1 month 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: build/android/pylib/linker/test_case.py
diff --git a/build/android/pylib/linker/test_case.py b/build/android/pylib/linker/test_case.py
index 3f8ea73212be91eaeedff3d781fe591e4b8dd484..b4bddc727c749c0cd5979860f45518360397203f 100644
--- a/build/android/pylib/linker/test_case.py
+++ b/build/android/pylib/linker/test_case.py
@@ -554,67 +554,3 @@ class LinkerRandomizationTest(LinkerTestCaseBase):
return ResultType.FAIL, renderer_logs
return ResultType.PASS, logs
-
-
-class LinkerLowMemoryThresholdTest(LinkerTestCaseBase):
- """This test checks that the definitions for the low-memory device physical
- RAM threshold are identical in the base/ and linker sources. Because these
- two components should absolutely not depend on each other, it's difficult
- to perform this check correctly at runtime inside the linker test binary
- without introducing hairy dependency issues in the build, or complicated
- plumbing at runtime.
-
- To work-around this, this test looks directly into the sources for a
- definition of the same constant that should look like:
-
- #define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB <number>
-
- And will check that the values for <number> are identical in all of
- them."""
-
- # A regular expression used to find the definition of the threshold in all
- # sources:
- _RE_THRESHOLD_DEFINITION = re.compile(
- r'^\s*#\s*define\s+ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB\s+(\d+)\s*$',
- re.MULTILINE)
-
- # The list of source files, relative to DIR_SOURCE_ROOT, which must contain
- # a line that matches the re above.
- _SOURCES_LIST = [
- 'base/android/sys_utils.cc',
- 'content/common/android/linker/linker_jni.cc' ]
-
- def _RunTest(self, adb):
- failure = False
- values = []
- # First, collect all the values in all input sources.
- re = LinkerLowMemoryThresholdTest._RE_THRESHOLD_DEFINITION
- for source in LinkerLowMemoryThresholdTest._SOURCES_LIST:
- source_path = os.path.join(constants.DIR_SOURCE_ROOT, source);
- if not os.path.exists(source_path):
- logging.error('Missing source file: ' + source_path)
- failure = True
- continue
- with open(source_path) as f:
- source_text = f.read()
- # For some reason, re.match() never works here.
- source_values = re.findall(source_text)
- if not source_values:
- logging.error('Missing low-memory threshold definition in ' + \
- source_path)
- logging.error('Source:\n%s\n' % source_text)
- failure = True
- continue
- values += source_values
-
- # Second, check that they are all the same.
- if not failure:
- for value in values[1:]:
- if value != values[0]:
- logging.error('Value mismatch: ' + repr(values))
- failure = True
-
- if failure:
- return ResultType.FAIL, 'Incorrect low-end memory threshold definitions!'
-
- return ResultType.PASS, ''

Powered by Google App Engine
This is Rietveld 408576698