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 "../OmahaXMLRequest.h" | |
|
Mark Mentovai
2016/07/15 21:56:08
#import this one. Also, we should probably move to
Anna Zeng
2016/07/22 16:58:02
Done.
Anna Zeng
2016/07/22 16:58:02
Acknowledged.
| |
| 6 #include "testing/gtest/include/gtest/gtest.h" | |
| 7 | |
| 8 namespace { | |
| 9 | |
| 10 class OmahaXMLRequestTest : public ::testing::Test { | |
| 11 protected: | |
| 12 OmahaXMLRequestTest() : Test() { | |
| 13 xmlBody = [OmahaXMLRequest createXMLRequestBody]; | |
| 14 } | |
| 15 | |
| 16 virtual ~OmahaXMLRequestTest() { [xmlBody release]; } | |
|
Mark Mentovai
2016/07/15 21:56:08
Here’s where scoped_nsobject would be handy: you w
Anna Zeng
2016/07/22 16:58:01
Done.
Anna Zeng
2016/07/22 16:58:02
Acknowledged.
| |
| 17 | |
| 18 NSXMLDocument* xmlBody; | |
|
Mark Mentovai
2016/07/15 21:56:08
Remember to use trailing underscores for your memb
Mark Mentovai
2016/07/15 21:56:09
This should be in a private: section. https://goog
Anna Zeng
2016/07/18 18:15:53
From the above link: " For technical reasons, we a
Anna Zeng
2016/07/22 16:58:01
Done.
Anna Zeng
2016/07/22 16:58:02
Acknowledged.
Anna Zeng
2016/07/22 16:58:02
Acknowledged.
| |
| 19 }; | |
|
Mark Mentovai
2016/07/15 21:56:08
The private: section should also end with DISALLOW
Anna Zeng
2016/07/22 01:45:37
Since there is no private: section and this is tes
Anna Zeng
2016/07/22 16:58:02
Acknowledged.
| |
| 20 | |
| 21 TEST_F(OmahaXMLRequestTest, createDoesNotReturnNil) { | |
| 22 EXPECT_NE(xmlBody, nil); | |
|
Mark Mentovai
2016/07/15 21:56:08
EXPECT_TRUE(xml_body_) is fine.
Mark Mentovai
2016/07/15 21:56:08
Not sure that you need this independent test case.
Mark Mentovai
2016/07/22 15:42:38
I wrote:
Anna Zeng
2016/07/22 16:43:21
Oh oops! I recall addressing this somehow. Thanks
| |
| 23 } | |
| 24 | |
| 25 TEST_F(OmahaXMLRequestTest, createReturnsValidXML) { | |
|
Mark Mentovai
2016/07/15 21:56:08
Test case names should begin with capital letters.
Anna Zeng
2016/07/22 16:58:02
Done.
| |
| 26 NSString* requestDTDLocation = | |
| 27 [[[NSFileManager defaultManager] currentDirectoryPath] | |
| 28 stringByAppendingString:@"/testing/requestCheck.dtd"]; | |
| 29 NSData* requestDTDData = [NSData dataWithContentsOfFile:requestDTDLocation]; | |
| 30 NSError* error; | |
| 31 NSXMLDTD* requestXMLChecker = | |
| 32 [[NSXMLDTD alloc] initWithData:requestDTDData options:0 error:&error]; | |
| 33 [requestXMLChecker setName:@"request"]; | |
| 34 [xmlBody setDTD:requestXMLChecker]; | |
| 35 EXPECT_TRUE([xmlBody validateAndReturnError:&error]); | |
| 36 } | |
| 37 | |
|
Mark Mentovai
2016/07/15 21:56:08
Do you want to parse the XML a bit more to make su
Anna Zeng
2016/07/22 01:45:37
I'm able to currently guarantee lack of whitespace
| |
| 38 } // namespace | |
| OLD | NEW |