diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm index 6e447661c..0fecdd337 100755 --- a/Atom/src/Atom.mm +++ b/Atom/src/Atom.mm @@ -84,6 +84,13 @@ } +- (void)exitAfterSpecs { + [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { + CefRefPtr atom = context->GetGlobal()->GetValue("atom"); + atom->SetValue("exitAfterSpecs", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); + }]; +} + - (CefRefPtr)atomContext { return _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); } @@ -116,20 +123,12 @@ - (void)loadEnd { if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--benchmark"]) { - [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { - CefRefPtr atom = context->GetGlobal()->GetValue("atom"); - atom->SetValue("exitAfterSpecs", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); - }]; - + [self exitAfterSpecs]; [self runBenchmarks:self]; } if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--test"]) { - [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { - CefRefPtr atom = context->GetGlobal()->GetValue("atom"); - atom->SetValue("exitAfterSpecs", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); - }]; - + [self exitAfterSpecs]; [self runSpecs:self]; } }