Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: chrome/installer/mac/app/testing/OmahaXMLRequest_test.mm

Issue 2137743002: Added test files for SystemInfo.m and OmahaXMLRequest.m. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Transitioned fully to super-concise tests; ready for more comments! Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698