Skip to content

Commit 9dab7c1

Browse files
committed
Fixed VersionHandlerImpl test
The test failed due to changes in f162d81. Change-Id: I6e87b6dd2dd74dfcfa1a4c55da12d8a120d45731
1 parent 8bcea64 commit 9dab7c1

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

source/VersionHandlerImpl/unit_tests/src/EditorMeasurementTest.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private EditorMeasurement CreateEditorMeasurement() {
135135
var analytics = new EditorMeasurement(settings, ProjectSettings.logger, GA_TRACKING_ID,
136136
SETTINGS_NAMESPACE, PLUGIN_NAME,
137137
DATA_COLLECTION_DESCRIPTION, PRIVACY_POLICY);
138-
analytics.displayDialog = (title, message, defaultOption, option0, option1,
138+
analytics.displayDialog = (title, message, defaultOption, option0, option1, Nullable,
139139
windowWidth, windowCloseOption,
140140
complete, renderContent, renderButtons, init) => {
141141
throw new Exception("Unexpected dialog displayed");
@@ -187,18 +187,19 @@ public void Construct() {
187187
private DialogWindow.DisplayDelegate CreateDisplayDialogDelegate(
188188
List<DialogWindow.Option> selectedOptions) {
189189
return (string title, string message, DialogWindow.Option defaultOption,
190-
string option0, string option1,
190+
string option0, string option1, string option2,
191191
float windowWidth, DialogWindow.Option windowCloseOption,
192192
Action<DialogWindow.Option> complete,
193193
Action<DialogWindow> renderContent,
194194
Action<DialogWindow> renderButtons,
195195
Action<DialogWindow> init) => {
196196
Assert.That(title, Is.Not.Empty);
197197
Assert.That(message, Is.Not.Empty);
198-
Assert.That(defaultOption, Is.EqualTo(DialogWindow.Option.Selected0));
198+
Assert.That(defaultOption, Is.EqualTo(DialogWindow.Option.Selected1));
199199
Assert.That(option0, Is.Not.Empty);
200200
Assert.That(option1, Is.Not.Empty);
201-
Assert.That(windowCloseOption, Is.EqualTo(DialogWindow.Option.Selected0));
201+
Assert.That(option2, Is.Null);
202+
Assert.That(windowCloseOption, Is.EqualTo(DialogWindow.Option.SelectedNone));
202203
Assert.That(complete, Is.Not.Null);
203204
Assert.That(renderContent, Is.Not.Null);
204205
Assert.That(renderButtons, Is.Not.Null);
@@ -216,7 +217,7 @@ public void PromptToEnableYes() {
216217
var analytics = CreateEditorMeasurement();
217218
analytics.displayDialog = CreateDisplayDialogDelegate(
218219
new List<DialogWindow.Option> {
219-
DialogWindow.Option.Selected1 /* yes */
220+
DialogWindow.Option.Selected0 /* yes */
220221
});
221222
Assert.That(analytics.Enabled, Is.EqualTo(true));
222223
Assert.That(analytics.ConsentRequested, Is.EqualTo(false));
@@ -234,7 +235,7 @@ public void PromptToEnableNo() {
234235
var analytics = CreateEditorMeasurement();
235236
analytics.displayDialog = CreateDisplayDialogDelegate(
236237
new List<DialogWindow.Option> {
237-
DialogWindow.Option.Selected0 /* no */
238+
DialogWindow.Option.Selected1 /* no */
238239
});
239240
Assert.That(analytics.Enabled, Is.EqualTo(true));
240241
Assert.That(analytics.ConsentRequested, Is.EqualTo(false));
@@ -253,7 +254,7 @@ public void RestoreDefaultSettings() {
253254
var analytics = CreateEditorMeasurement();
254255
analytics.displayDialog = CreateDisplayDialogDelegate(
255256
new List<DialogWindow.Option> {
256-
DialogWindow.Option.Selected0 /* no */
257+
DialogWindow.Option.Selected1 /* no */
257258
});
258259
Assert.That(analytics.Enabled, Is.EqualTo(true));
259260
Assert.That(analytics.ConsentRequested, Is.EqualTo(false));
@@ -275,7 +276,7 @@ public void GenerateCookies() {
275276
var analytics = CreateEditorMeasurement();
276277
analytics.displayDialog = CreateDisplayDialogDelegate(
277278
new List<DialogWindow.Option> {
278-
DialogWindow.Option.Selected1 /* yes */
279+
DialogWindow.Option.Selected0 /* yes */
279280
});
280281
Assert.That(analytics.Cookie, Is.EqualTo(""));
281282
Assert.That(analytics.SystemCookie, Is.EqualTo(""));
@@ -292,7 +293,7 @@ public void GenerateCookies() {
292293
public void ReportWithoutConsent() {
293294
var analytics = CreateEditorMeasurement();
294295
var selectedOptions = new List<DialogWindow.Option> {
295-
DialogWindow.Option.Selected0 /* no */ };
296+
DialogWindow.Option.Selected1 /* no */ };
296297
analytics.displayDialog = CreateDisplayDialogDelegate(selectedOptions);
297298
analytics.Report("/a/new/event", "something interesting");
298299
analytics.Report("/a/new/event", "something else");
@@ -375,7 +376,7 @@ private KeyValuePair<string, string>[] CreateMeasurementEvents(
375376
public void ReportWithConsent() {
376377
var analytics = CreateEditorMeasurement();
377378
var selectedOptions = new List<DialogWindow.Option> {
378-
DialogWindow.Option.Selected1 /* yes */ };
379+
DialogWindow.Option.Selected0 /* yes */ };
379380
analytics.displayDialog = CreateDisplayDialogDelegate(selectedOptions);
380381
analytics.Report("/a/new/event", "something interesting");
381382
analytics.Report("/a/new/event#neat", "something else");
@@ -415,7 +416,7 @@ public void ReportWithConsentWithBasePathQueryAndReportName() {
415416
analytics.BaseQuery = "version=1.2.3";
416417
analytics.BaseReportName = "My Plugin: ";
417418
var selectedOptions = new List<DialogWindow.Option> {
418-
DialogWindow.Option.Selected1 /* yes */ };
419+
DialogWindow.Option.Selected0 /* yes */ };
419420
analytics.displayDialog = CreateDisplayDialogDelegate(selectedOptions);
420421
analytics.Report("/a/new/event", "something interesting");
421422
Assert.That(webRequest.PostedUrlAndForms,
@@ -439,7 +440,7 @@ public void ReportWithConsentWithBasePathQueryCommonParamsAndReportName() {
439440
analytics.BaseQuery = "version=1.2.3";
440441
analytics.BaseReportName = "My Plugin: ";
441442
var selectedOptions = new List<DialogWindow.Option> {
442-
DialogWindow.Option.Selected1 /* yes */ };
443+
DialogWindow.Option.Selected0 /* yes */ };
443444
analytics.displayDialog = CreateDisplayDialogDelegate(selectedOptions);
444445
analytics.Report("/a/new/event", "something interesting");
445446
Assert.That(webRequest.PostedUrlAndForms,
@@ -463,7 +464,7 @@ public void TestInstallSourceFilename(string filename, string expectedInstallSou
463464
analytics.InstallSource = null;
464465
analytics.InstallSourceFilename = filename;
465466
var selectedOptions = new List<DialogWindow.Option> {
466-
DialogWindow.Option.Selected1 /* yes */ };
467+
DialogWindow.Option.Selected0 /* yes */ };
467468
analytics.displayDialog = CreateDisplayDialogDelegate(selectedOptions);
468469
analytics.Report("/a/new/event", "something interesting");
469470
Assert.That(webRequest.PostedUrlAndForms,
@@ -506,7 +507,7 @@ public void ReportWithConsentWithInstallSourceFilenameLibrary() {
506507
public void OpenUrl() {
507508
var analytics = CreateEditorMeasurement();
508509
var selectedOptions = new List<DialogWindow.Option> {
509-
DialogWindow.Option.Selected1 /* yes */ };
510+
DialogWindow.Option.Selected0 /* yes */ };
510511
analytics.displayDialog = CreateDisplayDialogDelegate(selectedOptions);
511512
analytics.OpenUrl("https://github.com/googlesamples/unity-jar-resolver?do=something" +
512513
"#version-handler-usage", "Version Handler Usage");

0 commit comments

Comments
 (0)