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

Side by Side Diff: media/tools/constrained_network_server/traffic_control_test.py

Issue 9127009: Constrained Network test does not fail fast under fatal conditions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nits. Created 8 years, 11 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """End-to-end tests for traffic control library.""" 7 """End-to-end tests for traffic control library."""
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 self.assertTrue(root_detail in output) 68 self.assertTrue(root_detail in output)
69 69
70 def testConfigureClassAdd(self): 70 def testConfigureClassAdd(self):
71 """Checks adding and deleting a class to the root qdisc.""" 71 """Checks adding and deleting a class to the root qdisc."""
72 config = { 72 config = {
73 'interface': self._INTERFACE, 73 'interface': self._INTERFACE,
74 'port': 12345, 74 'port': 12345,
75 'server_port': 33333, 75 'server_port': 33333,
76 'bandwidth': 2000 76 'bandwidth': 2000
77 } 77 }
78 # Convert Kbps to Kbit.
79 rate = config['bandwidth'] * 8
80 class_detail = ('class htb 1:%x root prio 0 rate %dKbit ceil %dKbit' % 78 class_detail = ('class htb 1:%x root prio 0 rate %dKbit ceil %dKbit' %
DaleCurtis 2012/01/06 23:19:42 s/Kbit/kbit/ ?
shadi 2012/01/07 04:56:19 They seem both to work. On 2012/01/06 23:19:42, Da
81 (config['port'], rate, rate)) 79 (config['port'], config['bandwidth'], config['bandwidth']))
82 80
83 # Add root qdisc. 81 # Add root qdisc.
84 traffic_control._AddRootQdisc(config['interface']) 82 traffic_control._AddRootQdisc(config['interface'])
85 83
86 # Assert class does not exist prior to adding it. 84 # Assert class does not exist prior to adding it.
87 command = ['tc', 'class', 'ls', 'dev', config['interface']] 85 command = ['tc', 'class', 'ls', 'dev', config['interface']]
88 output = traffic_control._Exec(command) 86 output = traffic_control._Exec(command)
89 self.assertFalse(class_detail in output) 87 self.assertFalse(class_detail in output)
90 88
91 # Add class to root. 89 # Add class to root.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 # Delete the filter. 164 # Delete the filter.
167 # The output of tc filter list is not None because tc adds default filters. 165 # The output of tc filter list is not None because tc adds default filters.
168 traffic_control._DeleteFilter(config['interface'], config['port']) 166 traffic_control._DeleteFilter(config['interface'], config['port'])
169 self.assertRaises(traffic_control.TrafficControlError, 167 self.assertRaises(traffic_control.TrafficControlError,
170 traffic_control._GetFilterHandleId, config['interface'], 168 traffic_control._GetFilterHandleId, config['interface'],
171 config['port']) 169 config['port'])
172 170
173 171
174 if __name__ == '__main__': 172 if __name__ == '__main__':
175 unittest.main() 173 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698