aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core.Tests
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2016-01-19 09:18:42 -0800
committerGravatar Michael Lumish <mlumish@google.com>2016-01-19 09:18:42 -0800
commit2bd2b3e4269106012e0d423d0e2abc9cfca3b406 (patch)
tree00c63b7b5bdcd02bd8b44dce3674d981b2ce02ce /src/csharp/Grpc.Core.Tests
parentd70b6dc761746015fc0dc70662dadd4bda533c7e (diff)
parent447ef7eaaac24bf236fff90c007e5b27b120b785 (diff)
Merge pull request #4730 from jtattermusch/revamp_native_loader
Revamp C# native loader
Diffstat (limited to 'src/csharp/Grpc.Core.Tests')
-rw-r--r--src/csharp/Grpc.Core.Tests/PInvokeTest.cs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs
index af55cb0566..da0ea2e6dc 100644
--- a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs
+++ b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -45,13 +45,9 @@ namespace Grpc.Core.Tests
{
public class PInvokeTest
{
- int counter;
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] OpCompletionDelegate callback);
+ static readonly NativeMethods Native = NativeMethods.Get();
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
+ int counter;
/// <summary>
/// (~1.26us .NET Windows)
@@ -87,7 +83,7 @@ namespace Grpc.Core.Tests
1000000, 10000000,
() =>
{
- grpcsharp_test_callback(handler);
+ Native.grpcsharp_test_callback(handler);
});
Assert.AreNotEqual(0, counter);
}
@@ -106,7 +102,7 @@ namespace Grpc.Core.Tests
10000, 10000,
() =>
{
- grpcsharp_test_callback(new OpCompletionDelegate(Handler));
+ Native.grpcsharp_test_callback(new OpCompletionDelegate(Handler));
});
Assert.AreNotEqual(0, counter);
}
@@ -122,7 +118,7 @@ namespace Grpc.Core.Tests
1000000, 100000000,
() =>
{
- grpcsharp_test_nop(IntPtr.Zero);
+ Native.grpcsharp_test_nop(IntPtr.Zero);
});
}