SEBWIN-219: Cleaned up remaining TODOs.

This commit is contained in:
dbuechel 2018-02-28 09:45:29 +01:00
parent 8a06a0fe98
commit f5ef7fa859
13 changed files with 37 additions and 25 deletions

View file

@ -45,7 +45,9 @@ namespace SafeExamBrowser.Browser
var cefSettings = new CefSettings var cefSettings = new CefSettings
{ {
CachePath = runtimeInfo.BrowserCachePath, CachePath = runtimeInfo.BrowserCachePath,
LogFile = runtimeInfo.BrowserLogFile LogFile = runtimeInfo.BrowserLogFile,
// TODO: Set according to current application LogLevel!
LogSeverity = LogSeverity.Verbose
}; };
var success = Cef.Initialize(cefSettings, true, null); var success = Cef.Initialize(cefSettings, true, null);

View file

@ -9,6 +9,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq; using Moq;
using SafeExamBrowser.Client.Behaviour.Operations; using SafeExamBrowser.Client.Behaviour.Operations;
using SafeExamBrowser.Contracts.Behaviour;
using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.Configuration.Settings; using SafeExamBrowser.Contracts.Configuration.Settings;
using SafeExamBrowser.Contracts.I18n; using SafeExamBrowser.Contracts.I18n;
@ -24,6 +25,8 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
{ {
private Mock<ILogger> loggerMock; private Mock<ILogger> loggerMock;
private TaskbarSettings settings; private TaskbarSettings settings;
private Mock<INotificationInfo> logInfoMock;
private Mock<INotificationController> logControllerMock;
private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock; private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock;
private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock; private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock;
private Mock<ISystemComponent<ISystemWirelessNetworkControl>> wirelessNetworkMock; private Mock<ISystemComponent<ISystemWirelessNetworkControl>> wirelessNetworkMock;
@ -38,12 +41,14 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
public void Initialize() public void Initialize()
{ {
loggerMock = new Mock<ILogger>(); loggerMock = new Mock<ILogger>();
settings = new TaskbarSettings(); logInfoMock = new Mock<INotificationInfo>();
logControllerMock = new Mock<INotificationController>();
keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>(); keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>();
powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>(); powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>();
wirelessNetworkMock = new Mock<ISystemComponent<ISystemWirelessNetworkControl>>(); wirelessNetworkMock = new Mock<ISystemComponent<ISystemWirelessNetworkControl>>();
systemInfoMock = new Mock<ISystemInfo>(); systemInfoMock = new Mock<ISystemInfo>();
taskbarMock = new Mock<ITaskbar>(); taskbarMock = new Mock<ITaskbar>();
settings = new TaskbarSettings();
textMock = new Mock<IText>(); textMock = new Mock<IText>();
uiFactoryMock = new Mock<IUserInterfaceFactory>(); uiFactoryMock = new Mock<IUserInterfaceFactory>();
@ -55,12 +60,14 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
sut = new TaskbarOperation( sut = new TaskbarOperation(
loggerMock.Object, loggerMock.Object,
settings, logInfoMock.Object,
logControllerMock.Object,
keyboardLayoutMock.Object, keyboardLayoutMock.Object,
powerSupplyMock.Object, powerSupplyMock.Object,
wirelessNetworkMock.Object, wirelessNetworkMock.Object,
systemInfoMock.Object, systemInfoMock.Object,
taskbarMock.Object, taskbarMock.Object,
settings,
textMock.Object, textMock.Object,
uiFactoryMock.Object); uiFactoryMock.Object);
} }

View file

@ -38,7 +38,7 @@ namespace SafeExamBrowser.Client.Behaviour.Operations
ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_InitializeProcessMonitoring); ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_InitializeProcessMonitoring);
// TODO // TODO: Implement process monitoring...
} }
public void Repeat() public void Repeat()
@ -51,7 +51,7 @@ namespace SafeExamBrowser.Client.Behaviour.Operations
logger.Info("Stopping process monitoring..."); logger.Info("Stopping process monitoring...");
ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_StopProcessMonitoring); ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_StopProcessMonitoring);
// TODO // TODO: Implement process monitoring...
ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_WaitExplorerStartup, true); ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_WaitExplorerStartup, true);

View file

@ -6,7 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using SafeExamBrowser.Client.Notifications;
using SafeExamBrowser.Contracts.Behaviour; using SafeExamBrowser.Contracts.Behaviour;
using SafeExamBrowser.Contracts.Behaviour.Operations; using SafeExamBrowser.Contracts.Behaviour.Operations;
using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Configuration;
@ -22,6 +21,7 @@ namespace SafeExamBrowser.Client.Behaviour.Operations
internal class TaskbarOperation : IOperation internal class TaskbarOperation : IOperation
{ {
private ILogger logger; private ILogger logger;
private INotificationInfo logInfo;
private INotificationController logController; private INotificationController logController;
private TaskbarSettings settings; private TaskbarSettings settings;
private ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout; private ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout;
@ -37,19 +37,23 @@ namespace SafeExamBrowser.Client.Behaviour.Operations
public TaskbarOperation( public TaskbarOperation(
ILogger logger, ILogger logger,
TaskbarSettings settings, INotificationInfo logInfo,
INotificationController logController,
ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout, ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout,
ISystemComponent<ISystemPowerSupplyControl> powerSupply, ISystemComponent<ISystemPowerSupplyControl> powerSupply,
ISystemComponent<ISystemWirelessNetworkControl> wirelessNetwork, ISystemComponent<ISystemWirelessNetworkControl> wirelessNetwork,
ISystemInfo systemInfo, ISystemInfo systemInfo,
ITaskbar taskbar, ITaskbar taskbar,
TaskbarSettings settings,
IText text, IText text,
IUserInterfaceFactory uiFactory) IUserInterfaceFactory uiFactory)
{ {
this.logger = logger; this.logger = logger;
this.settings = settings; this.logInfo = logInfo;
this.logController = logController;
this.keyboardLayout = keyboardLayout; this.keyboardLayout = keyboardLayout;
this.powerSupply = powerSupply; this.powerSupply = powerSupply;
this.settings = settings;
this.systemInfo = systemInfo; this.systemInfo = systemInfo;
this.taskbar = taskbar; this.taskbar = taskbar;
this.text = text; this.text = text;
@ -95,7 +99,7 @@ namespace SafeExamBrowser.Client.Behaviour.Operations
if (settings.AllowApplicationLog) if (settings.AllowApplicationLog)
{ {
logController?.Terminate(); logController.Terminate();
} }
if (settings.AllowKeyboardLayout) if (settings.AllowKeyboardLayout)
@ -140,13 +144,9 @@ namespace SafeExamBrowser.Client.Behaviour.Operations
private void CreateLogNotification() private void CreateLogNotification()
{ {
// TODO: Resolve dependencies -> CompositionRoot!
var logInfo = new LogNotificationInfo(text);
var logNotification = uiFactory.CreateNotification(logInfo); var logNotification = uiFactory.CreateNotification(logInfo);
logController = new LogNotificationController(logger, uiFactory);
logController.RegisterNotification(logNotification); logController.RegisterNotification(logNotification);
taskbar.AddNotification(logNotification); taskbar.AddNotification(logNotification);
} }
} }

View file

@ -13,6 +13,7 @@ using SafeExamBrowser.Browser;
using SafeExamBrowser.Client.Behaviour; using SafeExamBrowser.Client.Behaviour;
using SafeExamBrowser.Client.Behaviour.Operations; using SafeExamBrowser.Client.Behaviour.Operations;
using SafeExamBrowser.Client.Communication; using SafeExamBrowser.Client.Communication;
using SafeExamBrowser.Client.Notifications;
using SafeExamBrowser.Configuration; using SafeExamBrowser.Configuration;
using SafeExamBrowser.Contracts.Behaviour; using SafeExamBrowser.Contracts.Behaviour;
using SafeExamBrowser.Contracts.Behaviour.Operations; using SafeExamBrowser.Contracts.Behaviour.Operations;
@ -180,9 +181,11 @@ namespace SafeExamBrowser.Client
private IOperation BuildTaskbarOperation() private IOperation BuildTaskbarOperation()
{ {
var keyboardLayout = new KeyboardLayout(new ModuleLogger(logger, typeof(KeyboardLayout)), text); var keyboardLayout = new KeyboardLayout(new ModuleLogger(logger, typeof(KeyboardLayout)), text);
var logController = new LogNotificationController(logger, uiFactory);
var logInfo = new LogNotificationInfo(text);
var powerSupply = new PowerSupply(new ModuleLogger(logger, typeof(PowerSupply)), text); var powerSupply = new PowerSupply(new ModuleLogger(logger, typeof(PowerSupply)), text);
var wirelessNetwork = new WirelessNetwork(new ModuleLogger(logger, typeof(WirelessNetwork)), text); var wirelessNetwork = new WirelessNetwork(new ModuleLogger(logger, typeof(WirelessNetwork)), text);
var operation = new TaskbarOperation(logger, configuration.Settings.Taskbar, keyboardLayout, powerSupply, wirelessNetwork, systemInfo, Taskbar, text, uiFactory); var operation = new TaskbarOperation(logger, logInfo, logController, keyboardLayout, powerSupply, wirelessNetwork, systemInfo, Taskbar, configuration.Settings.Taskbar, text, uiFactory);
return operation; return operation;
} }

View file

@ -59,7 +59,7 @@ namespace SafeExamBrowser.Configuration
public Settings LoadSettings(Uri path) public Settings LoadSettings(Uri path)
{ {
// TODO // TODO: Implement loading mechanism
return LoadDefaultSettings(); return LoadDefaultSettings();
} }
@ -68,7 +68,7 @@ namespace SafeExamBrowser.Configuration
{ {
var settings = new Settings() var settings = new Settings()
{ {
// TODO // TODO: Implement default settings
ServicePolicy = ServicePolicy.Optional ServicePolicy = ServicePolicy.Optional
}; };

View file

@ -13,7 +13,6 @@ using SafeExamBrowser.Contracts.Configuration.Settings;
namespace SafeExamBrowser.Contracts.Behaviour namespace SafeExamBrowser.Contracts.Behaviour
{ {
// TODO: Interface really needed?!
public interface IClientController public interface IClientController
{ {
/// <summary> /// <summary>

View file

@ -8,7 +8,6 @@
namespace SafeExamBrowser.Contracts.Behaviour namespace SafeExamBrowser.Contracts.Behaviour
{ {
// TODO: Interface really needed?!
public interface IRuntimeController public interface IRuntimeController
{ {
/// <summary> /// <summary>

View file

@ -48,7 +48,8 @@ namespace SafeExamBrowser.Core.Communication
return; return;
} }
// TODO: Send(new StartSessionMessage { Id = sessionId, Settings = settings }); // TODO: Implement service communication
// Send(new StartSessionMessage { Id = sessionId, Settings = settings });
} }
public void StopSession(Guid sessionId) public void StopSession(Guid sessionId)
@ -58,7 +59,8 @@ namespace SafeExamBrowser.Core.Communication
return; return;
} }
// TODO: Send(new StopSessionMessage { SessionId = sessionId }); // TODO: Implement service communication
// Send(new StopSessionMessage { SessionId = sessionId });
} }
private bool IgnoreOperation(string operationName) private bool IgnoreOperation(string operationName)

View file

@ -50,7 +50,7 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations
public void Repeat() public void Repeat()
{ {
// TODO // TODO: Depends on new kiosk mode!
} }
public void Revert() public void Revert()

View file

@ -65,7 +65,7 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations
public void Repeat() public void Repeat()
{ {
// TODO // TODO: Re-check if mandatory, if so, try to connect (if not connected) - otherwise, no action required (except maybe logging of status?)
} }
public void Revert() public void Revert()

View file

@ -15,7 +15,7 @@ namespace SafeExamBrowser.WindowsApi
{ {
private ILogger logger; private ILogger logger;
// TODO! // TODO: Implement desktop functionality!
public string CurrentName => "Default"; public string CurrentName => "Default";
public Desktop(ILogger logger) public Desktop(ILogger logger)

View file

@ -34,7 +34,7 @@ namespace SafeExamBrowser.WindowsApi
var startupInfo = new STARTUPINFO(); var startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(startupInfo); startupInfo.cb = Marshal.SizeOf(startupInfo);
// TODO: // TODO: Specify target desktop!
//startupInfo.lpDesktop = desktop.CurrentName; //startupInfo.lpDesktop = desktop.CurrentName;
var success = Kernel32.CreateProcess(null, commandLine, IntPtr.Zero, IntPtr.Zero, true, Constant.NORMAL_PRIORITY_CLASS, IntPtr.Zero, null, ref startupInfo, ref processInfo); var success = Kernel32.CreateProcess(null, commandLine, IntPtr.Zero, IntPtr.Zero, true, Constant.NORMAL_PRIORITY_CLASS, IntPtr.Zero, null, ref startupInfo, ref processInfo);