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

Unified Diff: third_party/grpc/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/grpc/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs b/third_party/grpc/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs
similarity index 58%
copy from third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs
copy to third_party/grpc/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs
index 968f8fb9b3aafb0fc5569eb217cb8a21079af4d3..d5315ed39b40da3dd5c706d27fa3aef2a87c28d8 100644
--- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs
+++ b/third_party/grpc/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs
@@ -1,7 +1,7 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+#region Copyright notice and license
+
+// Copyright 2015, Google Inc.
+// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,36 +28,40 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
#endregion
-using Google.Protobuf.Reflection;
-using UnitTest.Issues.TestProtos;
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Threading.Tasks;
+using Grpc.Core;
+using Grpc.Core.Internal;
+using Grpc.Core.Utils;
using NUnit.Framework;
-
-namespace Google.Protobuf
+namespace Grpc.Core.Tests
{
- /// <summary>
- /// Tests for issues which aren't easily compartmentalized into other unit tests.
- /// </summary>
- public class IssuesTest
+ public class ChannelCredentialsTest
{
- // Issue 45
[Test]
- public void FieldCalledItem()
+ public void InsecureCredentials_IsNonComposable()
{
- ItemField message = new ItemField { Item = 3 };
- FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
- Assert.NotNull(field);
- Assert.AreEqual(3, (int)field.Accessor.GetValue(message));
+ Assert.IsFalse(ChannelCredentials.Insecure.IsComposable);
}
[Test]
- public void ReservedNames()
+ public void ChannelCredentials_CreateComposite()
{
- var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 };
- // Underscores aren't reflected in the JSON.
- Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString());
+ var composite = ChannelCredentials.Create(new FakeChannelCredentials(true), new FakeCallCredentials());
+ Assert.IsFalse(composite.IsComposable);
+
+ Assert.Throws(typeof(ArgumentNullException), () => ChannelCredentials.Create(null, new FakeCallCredentials()));
+ Assert.Throws(typeof(ArgumentNullException), () => ChannelCredentials.Create(new FakeChannelCredentials(true), null));
+
+ // forbid composing non-composable
+ Assert.Throws(typeof(ArgumentException), () => ChannelCredentials.Create(new FakeChannelCredentials(false), new FakeCallCredentials()));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698