返回 DeepSeek-Reasonix
capabilities_test.go
根目录 / desktop / third_party / go-webview2 / pkg / edge / capabilities_test.go
1 package edge
2
3 import "testing"
4
5 func TestHasCapability(t *testing.T) {
6 tests := []struct {
7 name string
8 webview2RuntimeVersion string
9 capability Capability
10 want bool
11 }{
12 {
13 name: "GetAdditionalObjects supported",
14 webview2RuntimeVersion: "113.0.1774.30",
15 capability: GetAdditionalObjects,
16 want: true,
17 },
18 {
19 name: "GetAdditionalObjects not supported",
20 webview2RuntimeVersion: "113.0.1774.29",
21 capability: GetAdditionalObjects,
22 want: false,
23 },
24 {
25 name: "SwipeNavigation supported",
26 webview2RuntimeVersion: "94.0.992.31",
27 capability: SwipeNavigation,
28 want: true,
29 },
30 {
31 name: "SwipeNavigation not supported",
32 webview2RuntimeVersion: "94.0.992.30",
33 capability: SwipeNavigation,
34 want: false,
35 },
36 {
37 name: "AllowExternalDrop supported",
38 webview2RuntimeVersion: "100.0.1185.39",
39 capability: AllowExternalDrop,
40 want: true,
41 },
42 {
43 name: "AllowExternalDrop not supported",
44 webview2RuntimeVersion: "100.0.1185.38",
45 capability: AllowExternalDrop,
46 want: false,
47 },
48 {
49 name: "GeneralAutofillEnabled supported",
50 webview2RuntimeVersion: "100.0.1185.39",
51 capability: GeneralAutofillEnabled,
52 want: true,
53 },
54 {
55 name: "GeneralAutofillEnabled not supported",
56 webview2RuntimeVersion: "100.0.1185.38",
57 capability: GeneralAutofillEnabled,
58 want: false,
59 },
60 {
61 name: "PasswordAutosaveEnabled supported",
62 webview2RuntimeVersion: "100.0.1185.39",
63 capability: PasswordAutosaveEnabled,
64 want: true,
65 },
66 {
67 name: "PasswordAutosaveEnabled not supported",
68 webview2RuntimeVersion: "100.0.1185.38",
69 capability: PasswordAutosaveEnabled,
70 want: false,
71 },
72 {
73 name: "ScreenCapture supported",
74 webview2RuntimeVersion: "131.0.2903.40",
75 capability: ScreenCapture,
76 want: true,
77 },
78 {
79 name: "ScreenCapture not supported",
80 webview2RuntimeVersion: "131.0.2903.39",
81 capability: ScreenCapture,
82 want: false,
83 },
84 {
85 name: "NonClientRegion supported",
86 webview2RuntimeVersion: "131.0.2903.40",
87 capability: NonClientRegion,
88 want: true,
89 },
90 {
91 name: "NonClientRegion not supported",
92 webview2RuntimeVersion: "131.0.2903.39",
93 capability: NonClientRegion,
94 want: false,
95 },
96 {
97 name: "DownloadDialog supported",
98 webview2RuntimeVersion: "131.0.2903.40",
99 capability: DownloadDialog,
100 want: true,
101 },
102 {
103 name: "DownloadDialog not supported",
104 webview2RuntimeVersion: "131.0.2903.39",
105 capability: DownloadDialog,
106 want: false,
107 },
108 {
109 name: "BrowserExtension supported",
110 webview2RuntimeVersion: "131.0.2903.40",
111 capability: BrowserExtension,
112 want: true,
113 },
114 {
115 name: "BrowserExtension not supported",
116 webview2RuntimeVersion: "131.0.2903.39",
117 capability: BrowserExtension,
118 want: false,
119 },
120 {
121 name: "BasicAuthentication supported",
122 webview2RuntimeVersion: "131.0.2903.40",
123 capability: BasicAuthentication,
124 want: true,
125 },
126 {
127 name: "BasicAuthentication not supported",
128 webview2RuntimeVersion: "131.0.2903.39",
129 capability: BasicAuthentication,
130 want: false,
131 },
132 {
133 name: "SaveFileDialog supported",
134 webview2RuntimeVersion: "131.0.2903.40",
135 capability: SaveFileDialog,
136 want: true,
137 },
138 {
139 name: "SaveFileDialog not supported",
140 webview2RuntimeVersion: "131.0.2903.39",
141 capability: SaveFileDialog,
142 want: false,
143 },
144 {
145 name: "CustomScheme supported",
146 webview2RuntimeVersion: "98.0.1108.43",
147 capability: CustomScheme,
148 want: true,
149 },
150 {
151 name: "CustomScheme not supported",
152 webview2RuntimeVersion: "98.0.1108.42",
153 capability: CustomScheme,
154 want: false,
155 },
156 {
157 name: "PrintToPdf supported",
158 webview2RuntimeVersion: "98.0.1108.43",
159 capability: PrintToPdf,
160 want: true,
161 },
162 {
163 name: "PrintToPdf not supported",
164 webview2RuntimeVersion: "98.0.1108.42",
165 capability: PrintToPdf,
166 want: false,
167 },
168 {
169 name: "SharedBuffer supported",
170 webview2RuntimeVersion: "98.0.1108.43",
171 capability: SharedBuffer,
172 want: true,
173 },
174 {
175 name: "SharedBuffer not supported",
176 webview2RuntimeVersion: "98.0.1108.42",
177 capability: SharedBuffer,
178 want: false,
179 },
180 {
181 name: "ServerCertificate supported",
182 webview2RuntimeVersion: "98.0.1108.43",
183 capability: ServerCertificate,
184 want: true,
185 },
186 {
187 name: "ServerCertificate not supported",
188 webview2RuntimeVersion: "98.0.1108.42",
189 capability: ServerCertificate,
190 want: false,
191 },
192 {
193 name: "FrameNavigation supported",
194 webview2RuntimeVersion: "98.0.1108.43",
195 capability: FrameNavigation,
196 want: true,
197 },
198 {
199 name: "FrameNavigation not supported",
200 webview2RuntimeVersion: "98.0.1108.42",
201 capability: FrameNavigation,
202 want: false,
203 },
204 {
205 name: "ClientCertificate supported",
206 webview2RuntimeVersion: "97.0.1072.69",
207 capability: ClientCertificate,
208 want: true,
209 },
210 {
211 name: "ClientCertificate not supported",
212 webview2RuntimeVersion: "97.0.1072.68",
213 capability: ClientCertificate,
214 want: false,
215 },
216 {
217 name: "ContextMenus supported",
218 webview2RuntimeVersion: "97.0.1072.69",
219 capability: ContextMenus,
220 want: true,
221 },
222 {
223 name: "ContextMenus not supported",
224 webview2RuntimeVersion: "97.0.1072.68",
225 capability: ContextMenus,
226 want: false,
227 },
228 {
229 name: "BackgroundColor supported",
230 webview2RuntimeVersion: "97.0.1072.69",
231 capability: BackgroundColor,
232 want: true,
233 },
234 {
235 name: "BackgroundColor not supported",
236 webview2RuntimeVersion: "97.0.1072.68",
237 capability: BackgroundColor,
238 want: false,
239 },
240 {
241 name: "ScriptEnabled supported",
242 webview2RuntimeVersion: "97.0.1072.69",
243 capability: ScriptEnabled,
244 want: true,
245 },
246 {
247 name: "ScriptEnabled not supported",
248 webview2RuntimeVersion: "97.0.1072.68",
249 capability: ScriptEnabled,
250 want: false,
251 },
252 {
253 name: "StatusBar supported",
254 webview2RuntimeVersion: "97.0.1072.69",
255 capability: StatusBar,
256 want: true,
257 },
258 {
259 name: "StatusBar not supported",
260 webview2RuntimeVersion: "97.0.1072.68",
261 capability: StatusBar,
262 want: false,
263 },
264 {
265 name: "WebMessageReceived supported",
266 webview2RuntimeVersion: "95.0.1020.44",
267 capability: WebMessageReceived,
268 want: true,
269 },
270 {
271 name: "WebMessageReceived not supported",
272 webview2RuntimeVersion: "95.0.1020.43",
273 capability: WebMessageReceived,
274 want: false,
275 },
276 {
277 name: "NewWindowRequested supported",
278 webview2RuntimeVersion: "95.0.1020.44",
279 capability: NewWindowRequested,
280 want: true,
281 },
282 {
283 name: "NewWindowRequested not supported",
284 webview2RuntimeVersion: "95.0.1020.43",
285 capability: NewWindowRequested,
286 want: false,
287 },
288 {
289 name: "DocumentTitleChanged supported",
290 webview2RuntimeVersion: "95.0.1020.44",
291 capability: DocumentTitleChanged,
292 want: true,
293 },
294 {
295 name: "DocumentTitleChanged not supported",
296 webview2RuntimeVersion: "95.0.1020.43",
297 capability: DocumentTitleChanged,
298 want: false,
299 },
300 {
301 name: "ContainsFullScreen supported",
302 webview2RuntimeVersion: "95.0.1020.44",
303 capability: ContainsFullScreen,
304 want: true,
305 },
306 {
307 name: "ContainsFullScreen not supported",
308 webview2RuntimeVersion: "95.0.1020.43",
309 capability: ContainsFullScreen,
310 want: false,
311 },
312 {
313 name: "WebResourceRequested supported",
314 webview2RuntimeVersion: "95.0.1020.44",
315 capability: WebResourceRequested,
316 want: true,
317 },
318 {
319 name: "WebResourceRequested not supported",
320 webview2RuntimeVersion: "95.0.1020.43",
321 capability: WebResourceRequested,
322 want: false,
323 },
324 {
325 name: "NavigationStarting supported",
326 webview2RuntimeVersion: "94.0.992.31",
327 capability: NavigationStarting,
328 want: true,
329 },
330 {
331 name: "NavigationStarting not supported",
332 webview2RuntimeVersion: "94.0.992.30",
333 capability: NavigationStarting,
334 want: false,
335 },
336 {
337 name: "NavigationCompleted supported",
338 webview2RuntimeVersion: "94.0.992.31",
339 capability: NavigationCompleted,
340 want: true,
341 },
342 {
343 name: "NavigationCompleted not supported",
344 webview2RuntimeVersion: "94.0.992.30",
345 capability: NavigationCompleted,
346 want: false,
347 },
348 {
349 name: "FrameNavigationStarting supported",
350 webview2RuntimeVersion: "94.0.992.31",
351 capability: FrameNavigationStarting,
352 want: true,
353 },
354 {
355 name: "FrameNavigationStarting not supported",
356 webview2RuntimeVersion: "94.0.992.30",
357 capability: FrameNavigationStarting,
358 want: false,
359 },
360 {
361 name: "SourceChanged supported",
362 webview2RuntimeVersion: "94.0.992.31",
363 capability: SourceChanged,
364 want: true,
365 },
366 {
367 name: "SourceChanged not supported",
368 webview2RuntimeVersion: "94.0.992.30",
369 capability: SourceChanged,
370 want: false,
371 },
372 {
373 name: "HistoryChanged supported",
374 webview2RuntimeVersion: "94.0.992.31",
375 capability: HistoryChanged,
376 want: true,
377 },
378 {
379 name: "HistoryChanged not supported",
380 webview2RuntimeVersion: "94.0.992.30",
381 capability: HistoryChanged,
382 want: false,
383 },
384 {
385 name: "DOMContentLoaded supported",
386 webview2RuntimeVersion: "93.0.961.52",
387 capability: DOMContentLoaded,
388 want: true,
389 },
390 {
391 name: "DOMContentLoaded not supported",
392 webview2RuntimeVersion: "93.0.961.51",
393 capability: DOMContentLoaded,
394 want: false,
395 },
396 {
397 name: "WebResourceLoaded supported",
398 webview2RuntimeVersion: "93.0.961.52",
399 capability: WebResourceLoaded,
400 want: true,
401 },
402 {
403 name: "WebResourceLoaded not supported",
404 webview2RuntimeVersion: "93.0.961.51",
405 capability: WebResourceLoaded,
406 want: false,
407 },
408 {
409 name: "ScriptDialogOpening supported",
410 webview2RuntimeVersion: "93.0.961.52",
411 capability: ScriptDialogOpening,
412 want: true,
413 },
414 {
415 name: "ScriptDialogOpening not supported",
416 webview2RuntimeVersion: "93.0.961.51",
417 capability: ScriptDialogOpening,
418 want: false,
419 },
420 {
421 name: "PermissionRequested supported",
422 webview2RuntimeVersion: "93.0.961.52",
423 capability: PermissionRequested,
424 want: true,
425 },
426 {
427 name: "PermissionRequested not supported",
428 webview2RuntimeVersion: "93.0.961.51",
429 capability: PermissionRequested,
430 want: false,
431 },
432 {
433 name: "ProcessFailed supported",
434 webview2RuntimeVersion: "93.0.961.52",
435 capability: ProcessFailed,
436 want: true,
437 },
438 {
439 name: "ProcessFailed not supported",
440 webview2RuntimeVersion: "93.0.961.51",
441 capability: ProcessFailed,
442 want: false,
443 },
444 {
445 name: "AcceleratorKeyPressed supported",
446 webview2RuntimeVersion: "92.0.902.78",
447 capability: AcceleratorKeyPressed,
448 want: true,
449 },
450 {
451 name: "AcceleratorKeyPressed not supported",
452 webview2RuntimeVersion: "92.0.902.77",
453 capability: AcceleratorKeyPressed,
454 want: false,
455 },
456 {
457 name: "ZoomFactorChanged supported",
458 webview2RuntimeVersion: "92.0.902.78",
459 capability: ZoomFactorChanged,
460 want: true,
461 },
462 {
463 name: "ZoomFactorChanged not supported",
464 webview2RuntimeVersion: "92.0.902.77",
465 capability: ZoomFactorChanged,
466 want: false,
467 },
468 {
469 name: "MoveFocusRequested supported",
470 webview2RuntimeVersion: "92.0.902.78",
471 capability: MoveFocusRequested,
472 want: true,
473 },
474 {
475 name: "MoveFocusRequested not supported",
476 webview2RuntimeVersion: "92.0.902.77",
477 capability: MoveFocusRequested,
478 want: false,
479 },
480 {
481 name: "DevToolsProtocol supported",
482 webview2RuntimeVersion: "92.0.902.78",
483 capability: DevToolsProtocol,
484 want: true,
485 },
486 {
487 name: "DevToolsProtocol not supported",
488 webview2RuntimeVersion: "92.0.902.77",
489 capability: DevToolsProtocol,
490 want: false,
491 },
492 {
493 name: "BrowserProcessExited supported",
494 webview2RuntimeVersion: "92.0.902.78",
495 capability: BrowserProcessExited,
496 want: true,
497 },
498 {
499 name: "BrowserProcessExited not supported",
500 webview2RuntimeVersion: "92.0.902.77",
501 capability: BrowserProcessExited,
502 want: false,
503 },
504 {
505 name: "DefaultDownloadDialog supported",
506 webview2RuntimeVersion: "91.0.864.41",
507 capability: DefaultDownloadDialog,
508 want: true,
509 },
510 {
511 name: "DefaultDownloadDialog not supported",
512 webview2RuntimeVersion: "91.0.864.40",
513 capability: DefaultDownloadDialog,
514 want: false,
515 },
516 {
517 name: "DefaultContextMenus supported",
518 webview2RuntimeVersion: "91.0.864.41",
519 capability: DefaultContextMenus,
520 want: true,
521 },
522 {
523 name: "DefaultContextMenus not supported",
524 webview2RuntimeVersion: "91.0.864.40",
525 capability: DefaultContextMenus,
526 want: false,
527 },
528 {
529 name: "FaviconChanged supported",
530 webview2RuntimeVersion: "91.0.864.41",
531 capability: FaviconChanged,
532 want: true,
533 },
534 {
535 name: "FaviconChanged not supported",
536 webview2RuntimeVersion: "91.0.864.40",
537 capability: FaviconChanged,
538 want: false,
539 },
540 {
541 name: "WindowCloseRequested supported",
542 webview2RuntimeVersion: "91.0.864.41",
543 capability: WindowCloseRequested,
544 want: true,
545 },
546 {
547 name: "WindowCloseRequested not supported",
548 webview2RuntimeVersion: "91.0.864.40",
549 capability: WindowCloseRequested,
550 want: false,
551 },
552 {
553 name: "RasterizationScale supported",
554 webview2RuntimeVersion: "91.0.864.41",
555 capability: RasterizationScale,
556 want: true,
557 },
558 {
559 name: "RasterizationScale not supported",
560 webview2RuntimeVersion: "91.0.864.40",
561 capability: RasterizationScale,
562 want: false,
563 },
564 {
565 name: "SecurityUpdated supported",
566 webview2RuntimeVersion: "91.0.864.41",
567 capability: SecurityUpdated,
568 want: true,
569 },
570 {
571 name: "SecurityUpdated not supported",
572 webview2RuntimeVersion: "91.0.864.40",
573 capability: SecurityUpdated,
574 want: false,
575 },
576 {
577 name: "ProcessInfoReceived supported",
578 webview2RuntimeVersion: "91.0.864.41",
579 capability: ProcessInfoReceived,
580 want: true,
581 },
582 {
583 name: "ProcessInfoReceived not supported",
584 webview2RuntimeVersion: "91.0.864.40",
585 capability: ProcessInfoReceived,
586 want: false,
587 },
588 {
589 name: "FramePermissionRequested supported",
590 webview2RuntimeVersion: "91.0.864.41",
591 capability: FramePermissionRequested,
592 want: true,
593 },
594 {
595 name: "FramePermissionRequested not supported",
596 webview2RuntimeVersion: "91.0.864.40",
597 capability: FramePermissionRequested,
598 want: false,
599 },
600 {
601 name: "ClearBrowsingData supported",
602 webview2RuntimeVersion: "91.0.864.41",
603 capability: ClearBrowsingData,
604 want: true,
605 },
606 {
607 name: "ClearBrowsingData not supported",
608 webview2RuntimeVersion: "91.0.864.40",
609 capability: ClearBrowsingData,
610 want: false,
611 },
612 {
613 name: "IsMutedChanged supported",
614 webview2RuntimeVersion: "91.0.864.41",
615 capability: IsMutedChanged,
616 want: true,
617 },
618 {
619 name: "IsMutedChanged not supported",
620 webview2RuntimeVersion: "91.0.864.40",
621 capability: IsMutedChanged,
622 want: false,
623 },
624 }
625
626 for _, tt := range tests {
627 t.Run(tt.name, func(t *testing.T) {
628 if got := HasCapability(tt.webview2RuntimeVersion, tt.capability); got != tt.want {
629 t.Errorf("HasCapability() = %v, want %v", got, tt.want)
630 }
631 })
632 }
633 }
634
634 lines GO