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

Unified Diff: third_party/WebKit/Source/bindings/scripts/code_generator_web_module_test.py

Issue 2581613002: Use real IDL types in unit test stubs. (Closed)
Patch Set: Created 4 years 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: third_party/WebKit/Source/bindings/scripts/code_generator_web_module_test.py
diff --git a/third_party/WebKit/Source/bindings/scripts/code_generator_web_module_test.py b/third_party/WebKit/Source/bindings/scripts/code_generator_web_module_test.py
index 6a0e23cf41aa25facb9c443814b47c16631711ea..52542447fb81bce1e6bc157638e2c2e8ec3f7d13 100644
--- a/third_party/WebKit/Source/bindings/scripts/code_generator_web_module_test.py
+++ b/third_party/WebKit/Source/bindings/scripts/code_generator_web_module_test.py
@@ -9,6 +9,9 @@
import unittest
from code_generator_web_module import InterfaceContextBuilder
+from idl_definitions import IdlAttribute
+from idl_definitions import IdlOperation
+from idl_types import IdlType
# TODO(dglazkov): Convert to use actual objects, not stubs.
@@ -17,24 +20,16 @@ class IdlTestingHelper(object):
"""A collection of stub makers and helper utils to make testing code
generation easy."""
- def make_stub_object(self):
- return type('', (), {})()
-
- def add_idl_type_to_stub(self, stub, return_type):
- stub.idl_type = self.make_stub_object()
- stub.idl_type.preprocessed_type = self.make_stub_object()
- stub.idl_type.preprocessed_type.base_type = return_type
-
def make_stub_idl_attribute(self, name, return_type):
- idl_attribute_stub = self.make_stub_object()
+ idl_attribute_stub = IdlAttribute()
idl_attribute_stub.name = name
- self.add_idl_type_to_stub(idl_attribute_stub, return_type)
+ idl_attribute_stub.idl_type = IdlType(return_type)
return idl_attribute_stub
def make_stub_idl_operation(self, name, return_type):
- idl_operation_stub = self.make_stub_object()
+ idl_operation_stub = IdlOperation()
idl_operation_stub.name = name
- self.add_idl_type_to_stub(idl_operation_stub, return_type)
+ idl_operation_stub.idl_type = IdlType(return_type)
return idl_operation_stub

Powered by Google App Engine
This is Rietveld 408576698