OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #import <Foundation/Foundation.h> | |
6 #import "downloader.h" | |
7 #import "systemInfo.h" | |
8 #import "OmahaXMLRequest.h" | |
9 #import "OmahaCommunication.h" | |
10 | |
11 void talkToOmahaThenExecuteBlock(AfterBlock block) { | |
12 NSXMLDocument* requestBody = [OmahaXMLRequest | |
13 createXMLRequestBodyWithOS:[SystemInfo getOSVersion] | |
14 andArchitecture:[SystemInfo getArch]]; | |
15 OmahaCommunication* messenger = [[OmahaCommunication alloc] | |
16 initWithBody:requestBody]; | |
17 [messenger createOmahaRequest]; | |
18 [messenger setResponseHandlingWithBlock:block]; | |
19 [messenger sendRequest]; | |
20 } | |
21 | |
22 int main(){ | |
23 talkToOmahaThenExecuteBlock(^(NSData* data) { | |
Elly Fong-Jones
2016/07/06 15:22:02
This is taking the kind of shape we were talking a
| |
24 Downloader* download = [[Downloader alloc] init]; | |
25 [download downloadChromeImageToDownloadsDirectory: data]; | |
26 }); | |
27 | |
28 // [[NSRunLoop mainRunLoop] run]; | |
29 [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]] ; | |
Elly Fong-Jones
2016/07/06 15:22:02
why 3?
Anna Zeng
2016/07/07 15:24:53
it's 3 for random testing purposes; we usually use
| |
30 } | |
OLD | NEW |