(createFunc: () => T, interactWithViewFunc?: (view: T) => void, done?)
| 118 | } |
| 119 | |
| 120 | export function buildUIWithWeakRefAndInteract<T extends View>(createFunc: () => T, interactWithViewFunc?: (view: T) => void, done?) { |
| 121 | clearPage(); |
| 122 | const page = getCurrentPage(); |
| 123 | const weakRef = new WeakRef(createFunc()); |
| 124 | page.content = weakRef.get(); |
| 125 | if (interactWithViewFunc) { |
| 126 | interactWithViewFunc(weakRef.get()); |
| 127 | } |
| 128 | page.content = null; |
| 129 | // Give a change for native cleanup (e.g. keyboard close, etc.). |
| 130 | TKUnit.wait(0.001); |
| 131 | if (page.ios) { |
| 132 | /* tslint:disable:no-unused-expression */ |
| 133 | // Could cause GC on the next call. |
| 134 | // NOTE: Don't replace this with forceGC(); |
| 135 | new ArrayBuffer(4 * 1024 * 1024); |
| 136 | |
| 137 | // An additional GC and wait are needed since WebKit upgrade to version 12.0 |
| 138 | // (TEXT-FIELD.testMemoryLeak test started failing sporadically) |
| 139 | Utils.GC(); |
| 140 | TKUnit.wait(0.2); |
| 141 | } |
| 142 | Utils.GC(); |
| 143 | try { |
| 144 | TKUnit.assert(!weakRef.get(), weakRef.get() + ' leaked!'); |
| 145 | done(null); |
| 146 | } catch (ex) { |
| 147 | done(ex); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | export function navigateToModuleAndRunTest(moduleName, context, testFunction) { |
| 152 | let page = navigateToModule(moduleName, context); |
nothing calls this directly
no test coverage detected