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

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

Issue 2293923005: General comment cleaning / refactoring for Mac Installer (Closed)
Patch Set: Ivan fixes Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/installer/mac/app/Unpacker.h" 5 #import "chrome/installer/mac/app/Unpacker.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 - (void)unpacker:(Unpacker*)unpacker onUnmountFailure:(NSError*)error { 68 - (void)unpacker:(Unpacker*)unpacker onUnmountFailure:(NSError*)error {
69 [self fail]; 69 [self fail];
70 } 70 }
71 71
72 @end 72 @end
73 73
74 namespace { 74 namespace {
75 75
76 TEST(UnpackerTest, IntegrationTest) { 76 TEST(UnpackerTest, IntegrationTest) {
77 // create objects and semaphore 77 // Create objects and semaphore
78 Unpacker* unpack = [[Unpacker alloc] init]; 78 Unpacker* unpack = [[Unpacker alloc] init];
79 TestDelegate* test_delegate = [[TestDelegate alloc] init]; 79 TestDelegate* test_delegate = [[TestDelegate alloc] init];
80 unpack.delegate = test_delegate; 80 unpack.delegate = test_delegate;
81 81
82 // get a disk image to use to test 82 // Get a disk image to use to test
83 base::FilePath originalPath; 83 base::FilePath originalPath;
84 PathService::Get(base::DIR_SOURCE_ROOT, &originalPath); 84 PathService::Get(base::DIR_SOURCE_ROOT, &originalPath);
85 originalPath = originalPath.AppendASCII("chrome/test/data/mac_installer/"); 85 originalPath = originalPath.AppendASCII("chrome/test/data/mac_installer/");
86 base::FilePath copiedPath = base::FilePath(originalPath); 86 base::FilePath copiedPath = base::FilePath(originalPath);
87 NSString* diskImageOriginalPath = base::SysUTF8ToNSString( 87 NSString* diskImageOriginalPath = base::SysUTF8ToNSString(
88 (originalPath.AppendASCII("test-dmg.dmg")).value()); 88 (originalPath.AppendASCII("test-dmg.dmg")).value());
89 NSString* diskImageCopiedPath = base::SysUTF8ToNSString( 89 NSString* diskImageCopiedPath = base::SysUTF8ToNSString(
90 (originalPath.AppendASCII("test-dmg2.dmg")).value()); 90 (originalPath.AppendASCII("test-dmg2.dmg")).value());
91 // The unpacker moves (not copies) a downloaded disk image directly into its
92 // own temporary directory, so if the below copy didn't happen, `test-dmg.dmg`
93 // would disappear every time this test was run
91 [[NSFileManager defaultManager] copyItemAtPath:diskImageOriginalPath 94 [[NSFileManager defaultManager] copyItemAtPath:diskImageOriginalPath
92 toPath:diskImageCopiedPath 95 toPath:diskImageCopiedPath
93 error:nil]; 96 error:nil];
94 NSURL* dmgURL = [NSURL fileURLWithPath:diskImageCopiedPath isDirectory:NO]; 97 NSURL* dmgURL = [NSURL fileURLWithPath:diskImageCopiedPath isDirectory:NO];
95 // start mount step 98 // Start mount step
96 [unpack mountDMGFromURL:dmgURL]; 99 [unpack mountDMGFromURL:dmgURL];
97 [test_delegate wait]; 100 [test_delegate wait];
98 101
99 // is the disk image mounted? 102 // Is the disk image mounted?
100 ASSERT_TRUE([test_delegate pass]); 103 ASSERT_TRUE([test_delegate pass]);
101 104
102 // start unmount step 105 // Start unmount step
103 [unpack unmountDMG]; 106 [unpack unmountDMG];
104 [test_delegate wait]; 107 [test_delegate wait];
105 108
106 // is the disk image gone? 109 // Is the disk image gone?
107 EXPECT_TRUE([test_delegate pass]); 110 EXPECT_TRUE([test_delegate pass]);
108 } 111 }
109 112
110 } // namespace 113 } // namespace
OLDNEW
« chrome/installer/mac/app/copy_to_disk.sh ('K') | « chrome/installer/mac/app/copy_to_disk.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698