Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/stats/test/logprocessor.py

Issue 29340823: Issue 3737 - Parse user agent strings from MS Edge (Closed)
Patch Set: Created April 25, 2016, 3:19 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/stats/bin/logprocessor.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2016 Eyeo GmbH 4 # Copyright (C) 2006-2016 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ("Chrome", "28.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/ 537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"), 43 ("Chrome", "28.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/ 537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"),
44 ("Chrome", "28.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/ 537.36 (KHTML, like Gecko) Iron/28.0.1550.0 Chrome/28.0.1550.0 Safari/537.36"), 44 ("Chrome", "28.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/ 537.36 (KHTML, like Gecko) Iron/28.0.1550.0 Chrome/28.0.1550.0 Safari/537.36"),
45 ("Safari", "5.0", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16"), 45 ("Safari", "5.0", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16"),
46 ("Mobile Safari", "4.0", "Mozilla/5.0 (Linux; U; Android 4.0.4; pt-b r; LG-E400 Build/IMM76L; CyanogenMod-9) AppleWebKit/534.30 (KHTML, like Gecko) V ersion/4.0 Mobile Safari/534.30"), 46 ("Mobile Safari", "4.0", "Mozilla/5.0 (Linux; U; Android 4.0.4; pt-b r; LG-E400 Build/IMM76L; CyanogenMod-9) AppleWebKit/534.30 (KHTML, like Gecko) V ersion/4.0 Mobile Safari/534.30"),
47 ("CoolNovo", "2.0.9", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebK it/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36 CoolNovo/2.0.9. 11"), 47 ("CoolNovo", "2.0.9", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebK it/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36 CoolNovo/2.0.9. 11"),
48 ("WebKit", "", "Mozilla/5.0 (Linux; U; Android 4.2.1; zh-CN; P7 Buil d/JRO03C) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.2.0.308 U3/0.8.0 Mo bile Safari/534.31"), 48 ("WebKit", "", "Mozilla/5.0 (Linux; U; Android 4.2.1; zh-CN; P7 Buil d/JRO03C) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.2.0.308 U3/0.8.0 Mo bile Safari/534.31"),
49 ("MSIE", "10.0", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1 ; WOW64; Trident/6.0)"), 49 ("MSIE", "10.0", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1 ; WOW64; Trident/6.0)"),
50 ("MSIE", "7.0", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)"), 50 ("MSIE", "7.0", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)"),
51 ("MSIE", "11.0", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Tou ch; rv:11.0) like Gecko"), 51 ("MSIE", "11.0", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Tou ch; rv:11.0) like Gecko"),
52 ("Trident", "7.0", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; T ouch) like Gecko"), 52 ("Trident", "7.0", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; T ouch) like Gecko"),
53 ("Edge", "12", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KH TML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"),
54 ("Edge", "12", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KH TML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136"),
55 ("Edge", "12", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.36 ( KHTML, like Gecko) Edge/12.10240"),
56 ("Edge", "12", "Mozilla/5.0 (Windows NT 6.3; Win64, x64; Touch) Appl eWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0 ( Touch; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; HPNTDFJS; H9P; InfoPath"),
53 ("Android", "", "AndroidDownloadManager"), 57 ("Android", "", "AndroidDownloadManager"),
54 ("Android", "4.1", "AndroidDownloadManager/4.1.1 (Linux; U; Android 4.1.1; A210 Build/JRO03H)"), 58 ("Android", "4.1", "AndroidDownloadManager/4.1.1 (Linux; U; Android 4.1.1; A210 Build/JRO03H)"),
55 ("Android", "4.0", "Dalvik/1.6.0 (Linux; U; Android 4.0.3; KFOT Buil d/IML74K)"), 59 ("Android", "4.0", "Dalvik/1.6.0 (Linux; U; Android 4.0.3; KFOT Buil d/IML74K)"),
56 ("Android", "4.3", "Dalvik/1.6.0 (Linux; U; Android 4.3; Nexus 7 Bui ld/JSS15J)"), 60 ("Android", "4.3", "Dalvik/1.6.0 (Linux; U; Android 4.3; Nexus 7 Bui ld/JSS15J)"),
57 ("Android", "", "Apache-HttpClient/UNAVAILABLE (java 1.4)"), 61 ("Android", "", "Apache-HttpClient/UNAVAILABLE (java 1.4)"),
58 ("ABP", "", "Adblock Plus"), 62 ("ABP", "", "Adblock Plus"),
59 ("Other", "", "-"), 63 ("Other", "", "-"),
60 ] 64 ]
61 for expected_browser, expected_version, ua in tests: 65 for expected_browser, expected_version, ua in tests:
62 self.assertEqual(logprocessor.parse_ua(ua), (expected_browser, expec ted_version), "Parsing user agent '%s'" % ua) 66 self.assertEqual(logprocessor.parse_ua(ua), (expected_browser, expec ted_version), "Parsing user agent '%s'" % ua)
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 "addonName": {"bar": {"hits": 1, "bandwidth": 200}} 737 "addonName": {"bar": {"hits": 1, "bandwidth": 200}}
734 }, 738 },
735 ), 739 ),
736 ] 740 ]
737 for info, section, ignored_fields, expected_result in tests: 741 for info, section, ignored_fields, expected_result in tests:
738 logprocessor.add_record(info, section, ignored_fields) 742 logprocessor.add_record(info, section, ignored_fields)
739 self.assertEqual(section, expected_result) 743 self.assertEqual(section, expected_result)
740 744
741 if __name__ == '__main__': 745 if __name__ == '__main__':
742 unittest.main() 746 unittest.main()
OLDNEW
« no previous file with comments | « sitescripts/stats/bin/logprocessor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld