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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/mocktool.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 17 matching lines...) Expand all
28 28
29 from webkitpy.common.host_mock import MockHost 29 from webkitpy.common.host_mock import MockHost
30 from webkitpy.common.net.buildbot_mock import MockBuildBot 30 from webkitpy.common.net.buildbot_mock import MockBuildBot
31 31
32 # FIXME: Old-style "Ports" need to die and be replaced by modern layout_tests.po rt which needs to move to common. 32 # FIXME: Old-style "Ports" need to die and be replaced by modern layout_tests.po rt which needs to move to common.
33 from webkitpy.common.config.ports_mock import MockPort 33 from webkitpy.common.config.ports_mock import MockPort
34 34
35 35
36 # FIXME: We should just replace this with optparse.Values(default=kwargs) 36 # FIXME: We should just replace this with optparse.Values(default=kwargs)
37 class MockOptions(object): 37 class MockOptions(object):
38
38 """Mock implementation of optparse.Values.""" 39 """Mock implementation of optparse.Values."""
39 40
40 def __init__(self, **kwargs): 41 def __init__(self, **kwargs):
41 # The caller can set option values using keyword arguments. We don't 42 # The caller can set option values using keyword arguments. We don't
42 # set any values by default because we don't know how this 43 # set any values by default because we don't know how this
43 # object will be used. Generally speaking unit tests should 44 # object will be used. Generally speaking unit tests should
44 # subclass this or provider wrapper functions that set a common 45 # subclass this or provider wrapper functions that set a common
45 # set of options. 46 # set of options.
46 self.update(**kwargs) 47 self.update(**kwargs)
47 48
48 def update(self, **kwargs): 49 def update(self, **kwargs):
49 self.__dict__.update(**kwargs) 50 self.__dict__.update(**kwargs)
50 return self 51 return self
51 52
52 def ensure_value(self, key, value): 53 def ensure_value(self, key, value):
53 if getattr(self, key, None) == None: 54 if getattr(self, key, None) is None:
54 self.__dict__[key] = value 55 self.__dict__[key] = value
55 return self.__dict__[key] 56 return self.__dict__[key]
56 57
57 58
58 # FIXME: This should be renamed MockWebKitPatch. 59 # FIXME: This should be renamed MockWebKitPatch.
59 class MockTool(MockHost): 60 class MockTool(MockHost):
60 61
61 def __init__(self, *args, **kwargs): 62 def __init__(self, *args, **kwargs):
62 MockHost.__init__(self, *args, **kwargs) 63 MockHost.__init__(self, *args, **kwargs)
63 64
64 self._deprecated_port = MockPort() 65 self._deprecated_port = MockPort()
65 66
66 def deprecated_port(self): 67 def deprecated_port(self):
67 return self._deprecated_port 68 return self._deprecated_port
68 69
69 def path(self): 70 def path(self):
70 return "echo" 71 return "echo"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698