| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package templates | 5 package templates |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "testing" | 8 "testing" |
| 9 | 9 |
| 10 "mojom/generators/go/translator" | 10 "mojom/generators/go/translator" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 func TestMethodOrdinals(t *testing.T) { | 58 func TestMethodOrdinals(t *testing.T) { |
| 59 expected := `const someInterface_FirstMethod_Ordinal uint32 = 10 | 59 expected := `const someInterface_FirstMethod_Ordinal uint32 = 10 |
| 60 const someInterface_SecondMethod_Ordinal uint32 = 21 | 60 const someInterface_SecondMethod_Ordinal uint32 = 21 |
| 61 ` | 61 ` |
| 62 | 62 |
| 63 i := testInterfaceTemplate() | 63 i := testInterfaceTemplate() |
| 64 | 64 |
| 65 check(t, expected, "MethodOrdinals", i) | 65 check(t, expected, "MethodOrdinals", i) |
| 66 } | 66 } |
| 67 |
| 68 func TestServiceName(t *testing.T) { |
| 69 expected := `const someInterface_Name string = "SomeService" |
| 70 |
| 71 func (r *SomeInterface_Request) Name() string { |
| 72 return someInterface_Name |
| 73 } |
| 74 |
| 75 func (p *SomeInterface_Pointer) Name() string { |
| 76 return someInterface_Name |
| 77 } |
| 78 |
| 79 func (f *SomeInterface_ServiceFactory) Name() string { |
| 80 return someInterface_Name |
| 81 }` |
| 82 |
| 83 serviceName := "SomeService" |
| 84 i := translator.InterfaceTemplate{ |
| 85 Name: "SomeInterface", |
| 86 PrivateName: "someInterface", |
| 87 ServiceName: &serviceName, |
| 88 } |
| 89 |
| 90 check(t, expected, "ServiceDecl", i) |
| 91 } |
| OLD | NEW |