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

Side by Side Diff: testing/coverage_util_ios.mm

Issue 2789433004: Add tools for code coverage support in iOS. (Closed)
Patch Set: Created 3 years, 8 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
« testing/coverage_util_ios.h ('K') | « testing/coverage_util_ios.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 <Foundation/Foundation.h>
6
7 extern "C" void __llvm_profile_set_filename(const char* name);
8
9 namespace coverage_util {
10
11 void SetupIfNecessary() {
12 #if !defined(NDEBUG)// && defined(ENABLE_TEST_CODE_COVERAGE)
lpromero 2017/03/31 11:22:06 I commented the ENABLE_TEST_CODE_COVERAGE variable
13 static dispatch_once_t onceToken;
Eugene But (OOO till 7-30) 2017/03/31 18:27:51 s/onceToken/once_token Same Style comment for the
lpromero 2017/03/31 20:35:20 Since this is now a .mm file, isn't it Objective-C
Eugene But (OOO till 7-30) 2017/03/31 20:42:13 C++ Style is used inside C-functions in C++ namesp
14 dispatch_once(&onceToken, ^{
15 // Writes the profraw file to the Documents directory, where the app has
16 // write rights.
17 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
18 NSUserDomainMask, YES);
19 NSString *documentsDirectory = [paths firstObject];
20 NSString *fileName =
21 [documentsDirectory stringByAppendingPathComponent:@"coverage.profraw"];
22
23 // For documentation, see:
24 // http://clang.llvm.org/docs/SourceBasedCodeCoverage.html
25 __llvm_profile_set_filename([fileName UTF8String]);
Eugene But (OOO till 7-30) 2017/03/31 18:27:51 Use sys_string_conversions ?
lpromero 2017/03/31 20:35:20 So there is a catch22 :) base depends on //testing
26
27 // Print the path for easier retrieval.
28 NSLog(@"Coverage data at %@.", fileName);
Eugene But (OOO till 7-30) 2017/03/31 18:27:51 Should this be DLOG instead?
lpromero 2017/03/31 20:35:20 Idem, I can't use base/logging.h.
29 });
30 #endif
31 }
32
33 } // namespace coverage_util
OLDNEW
« testing/coverage_util_ios.h ('K') | « testing/coverage_util_ios.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698