File tree 2 files changed +44
-0
lines changed
contrib/platform/test/com/sun/jna/platform/win32
2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -2099,4 +2099,14 @@ public void testVirtualLockUnlock() {
2099
2099
// Unlocking an unlocked region should fail
2100
2100
assertFalse (Kernel32 .INSTANCE .VirtualUnlock (mem , new SIZE_T (4096 )));
2101
2101
}
2102
+
2103
+ public void testSetPriorityClass () {
2104
+ HANDLE selfHandle = Kernel32 .INSTANCE .GetCurrentProcess ();
2105
+ assertTrue (Kernel32 .INSTANCE .SetPriorityClass (selfHandle , Kernel32 .HIGH_PRIORITY_CLASS );
2106
+ }
2107
+
2108
+ public void testSetPriorityClass () {
2109
+ HANDLE selfHandle = Kernel32 .INSTANCE .GetCurrentThread ();
2110
+ assertTrue (Kernel32 .INSTANCE .SetThreadPriority (selfHandle , Kernel32 .THREAD_PRIORITY_ABOVE_NORMAL );
2111
+ }
2102
2112
}
Original file line number Diff line number Diff line change @@ -513,4 +513,38 @@ public void testGetLogicalProcessorInformationEx() {
513
513
assertTrue (cache .associativity == WinNT .CACHE_FULLY_ASSOCIATIVE || cache .associativity > 0 );
514
514
}
515
515
}
516
+
517
+ public void testSetCurrentProcessPriority () {
518
+ try {
519
+ Kernel32Util .setCurrentProcessPriority (Kernel32 .HIGH_PRIORITY_CLASS );
520
+ } catch (Win32Exception e ) {
521
+ fail ("setCurrentProcessPriority() failed: " + e .getMessage ());
522
+ }
523
+ }
524
+
525
+ public void testSetCurrentThreadPriority () {
526
+ try {
527
+ Kernel32Util .setCurrentThreadPriority (Kernel32 .THREAD_PRIORITY_ABOVE_NORMAL );
528
+ } catch (Win32Exception e ) {
529
+ fail ("setCurrentThreadPriority() failed: " + e .getMessage ());
530
+ }
531
+ }
532
+
533
+ public void testSetProcessPriority () {
534
+ final int pid = Kernel32 .INSTANCE .GetCurrentProcessId ();
535
+ try {
536
+ Kernel32Util .setProcessPriority (pid , Kernel32 .HIGH_PRIORITY_CLASS );
537
+ } catch (Win32Exception e ) {
538
+ fail ("setProcessPriority() failed: " + e .getMessage ());
539
+ }
540
+ }
541
+
542
+ public void testSetThreadPriority () {
543
+ final int tid = Kernel32 .INSTANCE .GetCurrentThreadId ();
544
+ try {
545
+ Kernel32Util .setThreadPriority (tid , Kernel32 .HIGH_PRIORITY_CLASS );
546
+ } catch (Win32Exception e ) {
547
+ fail ("setThreadPriority() failed: " + e .getMessage ());
548
+ }
549
+ }
516
550
}
You can’t perform that action at this time.
0 commit comments