public void ClearAndIsEmpty() { CookieJar jar = new CookieJar(); jar.Store["a"] = "b"; Assert.IsFalse(jar.IsEmpty); jar.Clear(); Assert.IsTrue(jar.IsEmpty); }
public void ClearRemovesAllCookies() { var cookieJar = new CookieJar(); cookieJar.Add(new Uri("http://bar.ext"), new Cookie { Name = "a", Domain = "bar.ext" }); cookieJar.Add(new Uri("http://foo.bar.ext"), new Cookie { Name = "b", Domain = "bar.ext" }); cookieJar.Add(new Uri("http://foo.ext"), new Cookie { Name = "c", Domain = "foo.ext" }); cookieJar.Clear(); var cookies = cookieJar.GetCookies(new Uri("http://bar.ext")); Assert.Equal(0, cookies.Count); }
public static void ClearCookies() { CookieJar.Clear(); }
private void OnGUI() { GeneralStatistics stats = HTTPManager.GetGeneralStatistics(StatisticsQueryFlags.All); GUIHelper.DrawArea(new Rect(0f, 0f, (float)(Screen.width / 3), 160f), false, delegate { GUIHelper.DrawCenteredText("Connections"); GUILayout.Space(5f); GUIHelper.DrawRow("Active Connections:", stats.ActiveConnections.ToString()); GUIHelper.DrawRow("Free Connections:", stats.FreeConnections.ToString()); GUIHelper.DrawRow("Recycled Connections:", stats.RecycledConnections.ToString()); GUIHelper.DrawRow("Requests in queue:", stats.RequestsInQueue.ToString()); }); GUIHelper.DrawArea(new Rect((float)(Screen.width / 3), 0f, (float)(Screen.width / 3), 160f), false, delegate { GUIHelper.DrawCenteredText("Cache"); GUILayout.Space(5f); GUIHelper.DrawRow("Cached entities:", stats.CacheEntityCount.ToString()); GUIHelper.DrawRow("Sum Size (bytes): ", stats.CacheSize.ToString("N0")); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear Cache", new GUILayoutOption[0])) { HTTPCacheService.BeginClear(); } GUILayout.EndVertical(); }); GUIHelper.DrawArea(new Rect((float)(Screen.width / 3 * 2), 0f, (float)(Screen.width / 3), 160f), false, delegate { GUIHelper.DrawCenteredText("Cookies"); GUILayout.Space(5f); GUIHelper.DrawRow("Cookies:", stats.CookieCount.ToString()); GUIHelper.DrawRow("Estimated size (bytes):", stats.CookieJarSize.ToString("N0")); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear Cookies", new GUILayoutOption[0])) { CookieJar.Clear(); } GUILayout.EndVertical(); }); if (SampleSelector.SelectedSample == null || (SampleSelector.SelectedSample != null && !SampleSelector.SelectedSample.IsRunning)) { GUIHelper.DrawArea(new Rect(0f, 165f, (float)((SampleSelector.SelectedSample != null) ? (Screen.width / 3) : Screen.width), (float)(Screen.height - 160 - 5)), false, delegate { this.scrollPos = GUILayout.BeginScrollView(this.scrollPos, new GUILayoutOption[0]); for (int i = 0; i < this.Samples.Count; i++) { this.DrawSample(this.Samples[i]); } GUILayout.EndScrollView(); }); if (SampleSelector.SelectedSample != null) { this.DrawSampleDetails(SampleSelector.SelectedSample); } } else if (SampleSelector.SelectedSample != null && SampleSelector.SelectedSample.IsRunning) { GUILayout.BeginArea(new Rect(0f, (float)(Screen.height - 50), (float)Screen.width, 50f), string.Empty); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Back", new GUILayoutOption[] { GUILayout.MinWidth(100f) })) { SampleSelector.SelectedSample.DestroyUnityObject(); } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); } }