Chromium Code Reviews| Index: chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm |
| diff --git a/chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm b/chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..37d873b0d3268f1ab09fd1a57bd228f5fd934458 |
| --- /dev/null |
| +++ b/chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm |
| @@ -0,0 +1,30 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/mac/scoped_nsobject.h" |
| +#include "base/macros.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +#import "chrome/installer/mac/app/OmahaXMLRequest.h" |
|
Mark Mentovai
2016/07/22 18:03:24
This should be the _first_ #import in the file. Wh
|
| + |
| +namespace { |
| + |
| +TEST(OmahaXMLRequestTest, CreateReturnsValidXML) { |
| + base::scoped_nsobject<NSXMLDocument> xml_body_( |
| + [OmahaXMLRequest createXMLRequestBody]); |
| + ASSERT_TRUE(xml_body_); |
| + |
| + NSString* requestDTDLocation = |
| + [[[NSFileManager defaultManager] currentDirectoryPath] |
| + stringByAppendingString:@"/testing/requestCheck.dtd"]; |
| + NSData* requestDTDData = [NSData dataWithContentsOfFile:requestDTDLocation]; |
| + NSError* error; |
| + NSXMLDTD* requestXMLChecker = |
| + [[NSXMLDTD alloc] initWithData:requestDTDData options:0 error:&error]; |
| + [requestXMLChecker setName:@"request"]; |
| + [xml_body_ setDTD:requestXMLChecker]; |
| + EXPECT_TRUE([xml_body_ validateAndReturnError:&error]); |
| +} |
| + |
| +} // namespace |