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..9933eaeb2db66f7335af7427b274d02e91293659 |
| --- /dev/null |
| +++ b/chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm |
| @@ -0,0 +1,38 @@ |
| +// 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 "../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.
|
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace { |
| + |
| +class OmahaXMLRequestTest : public ::testing::Test { |
| + protected: |
| + OmahaXMLRequestTest() : Test() { |
| + xmlBody = [OmahaXMLRequest createXMLRequestBody]; |
| + } |
| + |
| + 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.
|
| + |
| + 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.
|
| +}; |
|
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.
|
| + |
| +TEST_F(OmahaXMLRequestTest, createDoesNotReturnNil) { |
| + 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
|
| +} |
| + |
| +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.
|
| + 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"]; |
| + [xmlBody setDTD:requestXMLChecker]; |
| + EXPECT_TRUE([xmlBody validateAndReturnError:&error]); |
| +} |
| + |
|
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
|
| +} // namespace |