mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-22 10:42:10 +10:00
Refactor WiFiManager: extract server and handlers into separate modules
- Move server lifecycle management to WiFiManagerServer - Move HTTP handlers and rendering to WiFiManagerHandlers - Move DEBUG_WM template definitions to WiFiManagerDebug - Implement lazy initialization of server manager to save memory - Add proper cleanup in destructor and on multiple createServer calls - Update tests to use getServer() and getDNSServer() accessors
This commit is contained in:
@@ -15,13 +15,13 @@ void test_dns_server_created() {
|
||||
|
||||
// Wait for DNS server to be created
|
||||
unsigned long start = millis();
|
||||
while (!wm.dnsServer && (millis() - start < 1000)) {
|
||||
while (!wm.getDNSServer() && (millis() - start < 1000)) {
|
||||
wm.process();
|
||||
delay(10);
|
||||
}
|
||||
|
||||
// DNS server should be created when portal starts
|
||||
TEST_ASSERT_NOT_NULL(wm.dnsServer);
|
||||
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
|
||||
|
||||
wm.stopConfigPortal();
|
||||
|
||||
@@ -40,13 +40,13 @@ void test_dns_server_cleanup() {
|
||||
|
||||
// Wait for DNS server to be created
|
||||
unsigned long start = millis();
|
||||
while (!wm.dnsServer && (millis() - start < 1000)) {
|
||||
while (!wm.getDNSServer() && (millis() - start < 1000)) {
|
||||
wm.process();
|
||||
delay(10);
|
||||
}
|
||||
|
||||
// Verify DNS server exists
|
||||
TEST_ASSERT_NOT_NULL(wm.dnsServer);
|
||||
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
|
||||
|
||||
// Stop portal
|
||||
wm.stopConfigPortal();
|
||||
@@ -72,11 +72,11 @@ void test_dns_server_lifecycle_cycles() {
|
||||
wm.process();
|
||||
|
||||
unsigned long start = millis();
|
||||
while (!wm.dnsServer && (millis() - start < 1000)) {
|
||||
while (!wm.getDNSServer() && (millis() - start < 1000)) {
|
||||
wm.process();
|
||||
delay(10);
|
||||
}
|
||||
TEST_ASSERT_NOT_NULL(wm.dnsServer);
|
||||
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
|
||||
|
||||
wm.stopConfigPortal();
|
||||
wm.process();
|
||||
@@ -87,11 +87,11 @@ void test_dns_server_lifecycle_cycles() {
|
||||
wm.process();
|
||||
|
||||
start = millis();
|
||||
while (!wm.dnsServer && (millis() - start < 1000)) {
|
||||
while (!wm.getDNSServer() && (millis() - start < 1000)) {
|
||||
wm.process();
|
||||
delay(10);
|
||||
}
|
||||
TEST_ASSERT_NOT_NULL(wm.dnsServer);
|
||||
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
|
||||
|
||||
wm.stopConfigPortal();
|
||||
wm.process();
|
||||
|
||||
Reference in New Issue
Block a user