public void DefaultAppDomainManager_setup_for_web_domains_follows_same_approximate_pattern_as_web_applications() { var module = new FakeCrosswalkModule { AppPoolInfo = { AppPoolName = "Testing", ClrConfigFile = @"x:\no-such-folder\testing.config" } }; using (CrosswalkModule.ReplaceCalls(module)) { var manager = new DefaultAppDomainManager(); var setup = new AppDomainSetup(); manager.InitializeNewDomain(setup); var domainId = module.AppPoolInfo.CreateAppDomain(@"x:\no-such-website\", "ID0", "CFG0"); // the fake set of calls don't really create another domain Assert.That(domainId, Is.EqualTo(AppDomain.CurrentDomain.Id)); // same default assumptions as a web app Assert.That(module.AppDomainSetup.ApplicationBase, Is.EqualTo(@"x:\no-such-website\")); Assert.That(module.AppDomainSetup.ConfigurationFile, Is.EqualTo(@"x:\no-such-website\Web.config")); Assert.That(module.AppDomainSetup.PrivateBinPath, Is.EqualTo(@"bin")); // specified a different class to finish initialization in the new domain Assert.That(module.AppDomainSetup.AppDomainManagerType, Is.StringEnding("WebAppDomainManager")); } }
public void DefaultAppDomainManager_adjusts_setup_and_provides_management_methods() { var module = new FakeCrosswalkModule { AppPoolInfo = { AppPoolName = "Testing", ClrConfigFile = @"x:\no-such-folder\testing.config" } }; using (CrosswalkModule.ReplaceCalls(module)) { Assert.That(module.AppPoolInfo.CreateAppDomain, Is.Null); Assert.That(module.AppPoolInfo.UnloadAppDomain, Is.Null); var manager = new DefaultAppDomainManager(); var setup = new AppDomainSetup(); manager.InitializeNewDomain(setup); Assert.That(setup.ConfigurationFile, Is.EqualTo(@"x:\no-such-folder\testing.config")); Assert.That(setup.ApplicationBase, Is.EqualTo(@"x:\no-such-folder")); Assert.That(module.AppPoolInfo.CreateAppDomain, Is.Not.Null); Assert.That(module.AppPoolInfo.UnloadAppDomain, Is.Not.Null); } }
public void BindHandler( ref CrosswalkModule.BindHandlerContext context, out CrosswalkModule.ExecuteHandlerDelegate executeHandler) { lock (_handlers) { if (!_handlers.TryGetValue(context.Name, out executeHandler)) { CrosswalkModule.BindHandlerDelegate binder; lock (_binders) { if (!_binders.TryGetValue(context.ManagedType, out binder)) { var parts = context.ManagedType.Split(new[] { "," }, 2, StringSplitOptions.None); var assembly = Assembly.Load(parts[1]); var type = assembly.GetType(parts[0]); var instance = (IBinder)Activator.CreateInstance(type); binder = instance.Bind; _binders.Add(context.ManagedType, binder); } } binder(ref context, out executeHandler); _handlers.Add(context.Name, executeHandler); } } }
public void Bind( ref CrosswalkModule.BindHandlerContext binding, out CrosswalkModule.ExecuteHandlerDelegate executeHandler) { var app = AppBuilder.BuildConfiguration(binding.ScriptProcessor); var handler = new Handler(app); executeHandler = handler.Execute; }
void CrosswalkModule.ICrosswalkModule.BindAppPoolInfo(ref CrosswalkModule.AppPoolInfo info) { // save incoming values AppPoolInfo.CreateAppDomain = info.CreateAppDomain; AppPoolInfo.UnloadAppDomain = info.UnloadAppDomain; // provide outgoing values info.AppPoolName = AppPoolInfo.AppPoolName; info.ClrConfigFile = AppPoolInfo.ClrConfigFile; }
public void WebAppDomainManager_provides_binder_method_as_the_domain_is_loading() { var module = new FakeCrosswalkModule(); using (CrosswalkModule.ReplaceCalls(module)) { Assert.That(module.AppHandlerInfo.BindHandler, Is.Null); var manager = new WebAppDomainManager(); var setup = new AppDomainSetup(); manager.InitializeNewDomain(setup); Assert.That(module.AppHandlerInfo.BindHandler, Is.Not.Null); } }
void CrosswalkModule.ICrosswalkModule.ResponseBody(object transaction, byte[] data, int offset, int count, CrosswalkModule.ContinuationDelegate continuation, out bool async) { ResponseBodyCalls++; async = false; }
void CrosswalkModule.ICrosswalkModule.BindAppHandlerInfo(ref CrosswalkModule.AppHandlerInfo info) { // save incoming values AppHandlerInfo.BindHandler = info.BindHandler; }
public void Init() { _module = new FakeCrosswalkModule(); _moduleDispose = CrosswalkModule.ReplaceCalls(_module); }