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..e6ea398e4a24d4f455a620a2e518f6501ce022e5 |
| --- /dev/null |
| +++ b/chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm |
| @@ -0,0 +1,37 @@ |
| +// 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" |
| + |
| +namespace { |
| + |
| +class OmahaXMLRequestTest : public ::testing::Test { |
| + protected: |
| + OmahaXMLRequestTest() : xml_body_([OmahaXMLRequest createXMLRequestBody]) {} |
| + |
| + base::scoped_nsobject<NSXMLDocument> xml_body_; |
| +}; |
| + |
| +TEST_F(OmahaXMLRequestTest, CreateDoesNotReturnNil) { |
| + EXPECT_TRUE(xml_body_); |
|
Mark Mentovai
2016/07/22 15:42:38
(this is what I was talking about—this was unaddre
Anna Zeng
2016/07/22 16:58:02
Done.
|
| +} |
| + |
| +TEST_F(OmahaXMLRequestTest, CreateReturnsValidXML) { |
| + NSString* requestDTDLocation = |
|
Mark Mentovai
2016/07/22 15:42:38
When you move EXPECT_TRUE(xml_body_) here, you’ll
Anna Zeng
2016/07/22 16:58:02
Thanks Mark! This is a good point here -- if the a
|
| + [[[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 |