Chromium Code Reviews| 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 #include "base/mac/scoped_nsobject.h" | |
| 6 #include "base/macros.h" | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 #import "chrome/installer/mac/app/OmahaXMLRequest.h" | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 class OmahaXMLRequestTest : public ::testing::Test { | |
| 14 protected: | |
| 15 OmahaXMLRequestTest() : xml_body_([OmahaXMLRequest createXMLRequestBody]) {} | |
| 16 | |
| 17 base::scoped_nsobject<NSXMLDocument> xml_body_; | |
| 18 }; | |
| 19 | |
| 20 TEST_F(OmahaXMLRequestTest, CreateDoesNotReturnNil) { | |
| 21 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.
| |
| 22 } | |
| 23 | |
| 24 TEST_F(OmahaXMLRequestTest, CreateReturnsValidXML) { | |
| 25 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
| |
| 26 [[[NSFileManager defaultManager] currentDirectoryPath] | |
| 27 stringByAppendingString:@"/testing/requestCheck.dtd"]; | |
| 28 NSData* requestDTDData = [NSData dataWithContentsOfFile:requestDTDLocation]; | |
| 29 NSError* error; | |
| 30 NSXMLDTD* requestXMLChecker = | |
| 31 [[NSXMLDTD alloc] initWithData:requestDTDData options:0 error:&error]; | |
| 32 [requestXMLChecker setName:@"request"]; | |
| 33 [xml_body_ setDTD:requestXMLChecker]; | |
| 34 EXPECT_TRUE([xml_body_ validateAndReturnError:&error]); | |
| 35 } | |
| 36 | |
| 37 } // namespace | |
| OLD | NEW |