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