aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-04-18 20:17:29 +0000
committerrsesek@chromium.org <rsesek@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-04-18 20:17:29 +0000
commit30bb1ab6015b462b5f2c4b3ce1986dec96d1f716 (patch)
treedcb02e594eeb0234448c5105f6c489777b1e3cbd /src
parentAdd Android ifdef to fix issue 526 (diff)
downloadbreakpad-30bb1ab6015b462b5f2c4b3ce1986dec96d1f716.tar.xz
Move SimpleStringDictionary from common/mac/ to just common/.
This also cleans up some things like the file name, trailing whitespace, and making the test use gtest instead of sentest, since there's nothing Mac specific about this. BUG=https://code.google.com/p/chromium/issues/detail?id=77656 Review URL: https://breakpad.appspot.com/561003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1154 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r--src/client/ios/Breakpad.mm4
-rw-r--r--src/client/ios/Breakpad.xcodeproj/project.pbxproj16
-rw-r--r--src/client/mac/Breakpad.xcodeproj/project.pbxproj32
-rw-r--r--src/client/mac/Framework/Breakpad.mm2
-rw-r--r--src/client/mac/crash_generation/ConfigFile.h2
-rw-r--r--src/client/mac/crash_generation/ConfigFile.mm1
-rw-r--r--src/client/mac/crash_generation/Inspector.h2
-rw-r--r--src/client/mac/crash_generation/Inspector.mm1
-rw-r--r--src/client/mac/tests/SimpleStringDictionaryTest.h40
-rw-r--r--src/common/simple_string_dictionary.cc (renamed from src/common/mac/SimpleStringDictionary.mm)20
-rw-r--r--src/common/simple_string_dictionary.h (renamed from src/common/mac/SimpleStringDictionary.h)43
-rw-r--r--src/common/simple_string_dictionary_unittest.cc (renamed from src/client/mac/tests/SimpleStringDictionaryTest.mm)96
12 files changed, 94 insertions, 165 deletions
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm
index c3758a9f..39f4dc07 100644
--- a/src/client/ios/Breakpad.mm
+++ b/src/client/ios/Breakpad.mm
@@ -45,13 +45,13 @@
#include <sys/stat.h>
#include <sys/sysctl.h>
+#import "client/ios/handler/ios_exception_minidump_generator.h"
#import "client/mac/crash_generation/ConfigFile.h"
#import "client/mac/handler/exception_handler.h"
#import "client/mac/handler/minidump_generator.h"
#import "client/mac/sender/uploader.h"
-#import "common/mac/SimpleStringDictionary.h"
-#import "client/ios/handler/ios_exception_minidump_generator.h"
#import "client/mac/handler/protected_memory_allocator.h"
+#import "common/simple_string_dictionary.h"
#ifndef __EXCEPTIONS
// This file uses C++ try/catch (but shouldn't). Duplicate the macros from
diff --git a/src/client/ios/Breakpad.xcodeproj/project.pbxproj b/src/client/ios/Breakpad.xcodeproj/project.pbxproj
index 96986f20..11d05eae 100644
--- a/src/client/ios/Breakpad.xcodeproj/project.pbxproj
+++ b/src/client/ios/Breakpad.xcodeproj/project.pbxproj
@@ -36,8 +36,6 @@
16C7CE79147D4A4300776EAD /* GTMLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 16C7CC89147D4A4300776EAD /* GTMLogger.m */; };
16C7CE7A147D4A4300776EAD /* HTTPMultipartUpload.h in Headers */ = {isa = PBXBuildFile; fileRef = 16C7CC8A147D4A4300776EAD /* HTTPMultipartUpload.h */; };
16C7CE7B147D4A4300776EAD /* HTTPMultipartUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = 16C7CC8B147D4A4300776EAD /* HTTPMultipartUpload.m */; };
- 16C7CE7E147D4A4300776EAD /* SimpleStringDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 16C7CC8E147D4A4300776EAD /* SimpleStringDictionary.h */; };
- 16C7CE7F147D4A4300776EAD /* SimpleStringDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = 16C7CC8F147D4A4300776EAD /* SimpleStringDictionary.mm */; };
16C7CE83147D4A4300776EAD /* file_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = 16C7CC93147D4A4300776EAD /* file_id.cc */; };
16C7CE84147D4A4300776EAD /* file_id.h in Headers */ = {isa = PBXBuildFile; fileRef = 16C7CC94147D4A4300776EAD /* file_id.h */; };
16C7CE85147D4A4300776EAD /* macho_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = 16C7CC95147D4A4300776EAD /* macho_id.cc */; };
@@ -54,6 +52,8 @@
16C7CEA8147D4A4300776EAD /* string_conversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 16C7CCBA147D4A4300776EAD /* string_conversion.h */; };
16C92FAD150DF8330053D7BA /* BreakpadController.h in Headers */ = {isa = PBXBuildFile; fileRef = 16C92FAB150DF8330053D7BA /* BreakpadController.h */; };
16C92FAE150DF8330053D7BA /* BreakpadController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 16C92FAC150DF8330053D7BA /* BreakpadController.mm */; };
+ 1EEEB60F1720821900F7E689 /* simple_string_dictionary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1EEEB60C1720821900F7E689 /* simple_string_dictionary.cc */; };
+ 1EEEB6101720821900F7E689 /* simple_string_dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EEEB60D1720821900F7E689 /* simple_string_dictionary.h */; };
AA747D9F0F9514B9006C5449 /* Breakpad_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* Breakpad_Prefix.pch */; };
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
/* End PBXBuildFile section */
@@ -88,8 +88,6 @@
16C7CC89147D4A4300776EAD /* GTMLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMLogger.m; sourceTree = "<group>"; };
16C7CC8A147D4A4300776EAD /* HTTPMultipartUpload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPMultipartUpload.h; sourceTree = "<group>"; };
16C7CC8B147D4A4300776EAD /* HTTPMultipartUpload.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HTTPMultipartUpload.m; sourceTree = "<group>"; };
- 16C7CC8E147D4A4300776EAD /* SimpleStringDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleStringDictionary.h; sourceTree = "<group>"; };
- 16C7CC8F147D4A4300776EAD /* SimpleStringDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleStringDictionary.mm; sourceTree = "<group>"; };
16C7CC93147D4A4300776EAD /* file_id.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_id.cc; sourceTree = "<group>"; };
16C7CC94147D4A4300776EAD /* file_id.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = file_id.h; sourceTree = "<group>"; };
16C7CC95147D4A4300776EAD /* macho_id.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = macho_id.cc; sourceTree = "<group>"; };
@@ -106,6 +104,8 @@
16C7CCBA147D4A4300776EAD /* string_conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string_conversion.h; sourceTree = "<group>"; };
16C92FAB150DF8330053D7BA /* BreakpadController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BreakpadController.h; sourceTree = "<group>"; };
16C92FAC150DF8330053D7BA /* BreakpadController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BreakpadController.mm; sourceTree = "<group>"; };
+ 1EEEB60C1720821900F7E689 /* simple_string_dictionary.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simple_string_dictionary.cc; sourceTree = "<group>"; };
+ 1EEEB60D1720821900F7E689 /* simple_string_dictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_string_dictionary.h; sourceTree = "<group>"; };
AA747D9E0F9514B9006C5449 /* Breakpad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpad_Prefix.pch; sourceTree = SOURCE_ROOT; };
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
D2AAC07E0554694100DB518D /* libBreakpad.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libBreakpad.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -259,6 +259,8 @@
16C7CC47147D4A4300776EAD /* common */ = {
isa = PBXGroup;
children = (
+ 1EEEB60C1720821900F7E689 /* simple_string_dictionary.cc */,
+ 1EEEB60D1720821900F7E689 /* simple_string_dictionary.h */,
16C7CC4A147D4A4300776EAD /* convert_UTF.c */,
16C7CC4B147D4A4300776EAD /* convert_UTF.h */,
16C7CC82147D4A4300776EAD /* mac */,
@@ -278,8 +280,6 @@
16C7CC89147D4A4300776EAD /* GTMLogger.m */,
16C7CC8A147D4A4300776EAD /* HTTPMultipartUpload.h */,
16C7CC8B147D4A4300776EAD /* HTTPMultipartUpload.m */,
- 16C7CC8E147D4A4300776EAD /* SimpleStringDictionary.h */,
- 16C7CC8F147D4A4300776EAD /* SimpleStringDictionary.mm */,
16C7CC93147D4A4300776EAD /* file_id.cc */,
16C7CC94147D4A4300776EAD /* file_id.h */,
16C7CC95147D4A4300776EAD /* macho_id.cc */,
@@ -324,7 +324,6 @@
16C7CE41147D4A4300776EAD /* convert_UTF.h in Headers */,
16C7CE78147D4A4300776EAD /* GTMLogger.h in Headers */,
16C7CE7A147D4A4300776EAD /* HTTPMultipartUpload.h in Headers */,
- 16C7CE7E147D4A4300776EAD /* SimpleStringDictionary.h in Headers */,
16C7CE84147D4A4300776EAD /* file_id.h in Headers */,
16C7CE86147D4A4300776EAD /* macho_id.h in Headers */,
16C7CE8B147D4A4300776EAD /* macho_utilities.h in Headers */,
@@ -334,6 +333,7 @@
16C7CEA8147D4A4300776EAD /* string_conversion.h in Headers */,
16BFA67014E195E9009704F8 /* ios_exception_minidump_generator.h in Headers */,
16C92FAD150DF8330053D7BA /* BreakpadController.h in Headers */,
+ 1EEEB6101720821900F7E689 /* simple_string_dictionary.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -411,7 +411,6 @@
16C7CE40147D4A4300776EAD /* convert_UTF.c in Sources */,
16C7CE79147D4A4300776EAD /* GTMLogger.m in Sources */,
16C7CE7B147D4A4300776EAD /* HTTPMultipartUpload.m in Sources */,
- 16C7CE7F147D4A4300776EAD /* SimpleStringDictionary.mm in Sources */,
16C7CE83147D4A4300776EAD /* file_id.cc in Sources */,
16C7CE85147D4A4300776EAD /* macho_id.cc in Sources */,
16C7CE8A147D4A4300776EAD /* macho_utilities.cc in Sources */,
@@ -421,6 +420,7 @@
16C7CEA7147D4A4300776EAD /* string_conversion.cc in Sources */,
16BFA67214E1965A009704F8 /* ios_exception_minidump_generator.mm in Sources */,
16C92FAE150DF8330053D7BA /* BreakpadController.mm in Sources */,
+ 1EEEB60F1720821900F7E689 /* simple_string_dictionary.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/client/mac/Breakpad.xcodeproj/project.pbxproj b/src/client/mac/Breakpad.xcodeproj/project.pbxproj
index 9864ed4a..2507710b 100644
--- a/src/client/mac/Breakpad.xcodeproj/project.pbxproj
+++ b/src/client/mac/Breakpad.xcodeproj/project.pbxproj
@@ -44,6 +44,11 @@
163201E31443029300C4DBF5 /* ConfigFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = 163201D51443019E00C4DBF5 /* ConfigFile.mm */; };
16C7C918147D45AE00776EAD /* BreakpadDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 16C7C917147D45AE00776EAD /* BreakpadDefines.h */; settings = {ATTRIBUTES = (Public, ); }; };
16E02DB8147410F0008C604D /* uploader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 16E02DB4147410D4008C604D /* uploader.mm */; };
+ 1EEEB6231720829E00F7E689 /* simple_string_dictionary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1EEEB6211720829E00F7E689 /* simple_string_dictionary.cc */; };
+ 1EEEB6241720829E00F7E689 /* simple_string_dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EEEB6221720829E00F7E689 /* simple_string_dictionary.h */; };
+ 1EEEB6271720831E00F7E689 /* BreakpadFramework_Test.mm in Sources */ = {isa = PBXBuildFile; fileRef = F91AF5CF0FD60393009D8BE2 /* BreakpadFramework_Test.mm */; };
+ 1EEEB62A1720859200F7E689 /* simple_string_dictionary_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1EEEB6251720830600F7E689 /* simple_string_dictionary_unittest.cc */; };
+ 1EEEB62B1720868C00F7E689 /* simple_string_dictionary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1EEEB6211720829E00F7E689 /* simple_string_dictionary.cc */; };
3329D4ED0FA16D820007BBC5 /* Breakpad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3329D4EC0FA16D820007BBC5 /* Breakpad.xib */; };
33880C800F9E097100817F82 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 33880C7E0F9E097100817F82 /* InfoPlist.strings */; };
4084699D0F5D9CF900FDCA37 /* crash_report_sender.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4084699C0F5D9CF900FDCA37 /* crash_report_sender.icns */; };
@@ -141,7 +146,6 @@
D2F9A53F121383A1002747C1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
D2F9A541121383A1002747C1 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2F9A41512131EF0002747C1 /* libgtest.a */; };
D2F9A553121383DC002747C1 /* crash_generation_server_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = D2F9A4CE121336F7002747C1 /* crash_generation_server_test.cc */; };
- F91AF5D00FD60393009D8BE2 /* BreakpadFramework_Test.mm in Sources */ = {isa = PBXBuildFile; fileRef = F91AF5CF0FD60393009D8BE2 /* BreakpadFramework_Test.mm */; };
F91AF6210FD60784009D8BE2 /* Breakpad.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Breakpad.framework */; };
F9286B3A0F7EB25800A4DCC8 /* InspectorMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = F9286B390F7EB25800A4DCC8 /* InspectorMain.mm */; };
F92C53B80ECCE7B3009BE4BA /* Inspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = F92C53B70ECCE7B3009BE4BA /* Inspector.mm */; };
@@ -159,7 +163,6 @@
F92C56450ECD10CA009BE4BA /* MachIPC.mm in Sources */ = {isa = PBXBuildFile; fileRef = F92C53790ECCE635009BE4BA /* MachIPC.mm */; };
F92C56460ECD10CA009BE4BA /* minidump_file_writer.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C538F0ECCE70A009BE4BA /* minidump_file_writer.cc */; };
F92C56470ECD10CA009BE4BA /* minidump_generator.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C536F0ECCE3FD009BE4BA /* minidump_generator.cc */; };
- F92C56480ECD10CA009BE4BA /* SimpleStringDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = F92C53810ECCE635009BE4BA /* SimpleStringDictionary.mm */; };
F92C56490ECD10CA009BE4BA /* string_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53820ECCE635009BE4BA /* string_utilities.cc */; };
F92C564A0ECD10CA009BE4BA /* string_conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53850ECCE6AD009BE4BA /* string_conversion.cc */; };
F92C564C0ECD10DD009BE4BA /* breakpadUtilities.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F92C563C0ECD10B3009BE4BA /* breakpadUtilities.dylib */; };
@@ -211,8 +214,6 @@
F9C44EA20EF09F93003AEBAA /* HTTPMultipartUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = F92C53770ECCE635009BE4BA /* HTTPMultipartUpload.m */; };
F9C44EE50EF0A006003AEBAA /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F9C44EE40EF0A006003AEBAA /* SystemConfiguration.framework */; };
F9C44EE90EF0A3C1003AEBAA /* GTMLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = F9C44EE80EF0A3C1003AEBAA /* GTMLogger.m */; };
- F9C77DE20F7DD7E30045F7DB /* SimpleStringDictionaryTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = F9C77DE10F7DD7E30045F7DB /* SimpleStringDictionaryTest.mm */; };
- F9C77DE40F7DD82F0045F7DB /* SimpleStringDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = F92C53810ECCE635009BE4BA /* SimpleStringDictionary.mm */; };
F9C77E130F7DDF810045F7DB /* GTMSenTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = F9C77E120F7DDF810045F7DB /* GTMSenTestCase.m */; };
/* End PBXBuildFile section */
@@ -566,6 +567,9 @@
163202431443201300C4DBF5 /* uploader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = uploader.h; path = sender/uploader.h; sourceTree = "<group>"; };
16C7C917147D45AE00776EAD /* BreakpadDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BreakpadDefines.h; sourceTree = "<group>"; };
16E02DB4147410D4008C604D /* uploader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = uploader.mm; path = sender/uploader.mm; sourceTree = "<group>"; };
+ 1EEEB6211720829E00F7E689 /* simple_string_dictionary.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = simple_string_dictionary.cc; path = ../../common/simple_string_dictionary.cc; sourceTree = "<group>"; };
+ 1EEEB6221720829E00F7E689 /* simple_string_dictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = simple_string_dictionary.h; path = ../../common/simple_string_dictionary.h; sourceTree = "<group>"; };
+ 1EEEB6251720830600F7E689 /* simple_string_dictionary_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = simple_string_dictionary_unittest.cc; path = ../../common/simple_string_dictionary_unittest.cc; sourceTree = "<group>"; };
32DBCF5E0370ADEE00C91783 /* Breakpad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Breakpad_Prefix.pch; path = Framework/Breakpad_Prefix.pch; sourceTree = "<group>"; };
3329D4EC0FA16D820007BBC5 /* Breakpad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Breakpad.xib; path = sender/Breakpad.xib; sourceTree = "<group>"; };
33880C7F0F9E097100817F82 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = sender/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -651,8 +655,6 @@
F92C537D0ECCE635009BE4BA /* macho_utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macho_utilities.h; path = ../../common/mac/macho_utilities.h; sourceTree = SOURCE_ROOT; };
F92C537E0ECCE635009BE4BA /* macho_walker.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = macho_walker.cc; path = ../../common/mac/macho_walker.cc; sourceTree = SOURCE_ROOT; };
F92C537F0ECCE635009BE4BA /* macho_walker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macho_walker.h; path = ../../common/mac/macho_walker.h; sourceTree = SOURCE_ROOT; };
- F92C53800ECCE635009BE4BA /* SimpleStringDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleStringDictionary.h; path = ../../common/mac/SimpleStringDictionary.h; sourceTree = SOURCE_ROOT; };
- F92C53810ECCE635009BE4BA /* SimpleStringDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SimpleStringDictionary.mm; path = ../../common/mac/SimpleStringDictionary.mm; sourceTree = SOURCE_ROOT; };
F92C53820ECCE635009BE4BA /* string_utilities.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = string_utilities.cc; path = ../../common/mac/string_utilities.cc; sourceTree = SOURCE_ROOT; };
F92C53830ECCE635009BE4BA /* string_utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = string_utilities.h; path = ../../common/mac/string_utilities.h; sourceTree = SOURCE_ROOT; };
F92C53850ECCE6AD009BE4BA /* string_conversion.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = string_conversion.cc; path = ../../common/string_conversion.cc; sourceTree = SOURCE_ROOT; };
@@ -699,8 +701,6 @@
F9C44EE80EF0A3C1003AEBAA /* GTMLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMLogger.m; path = ../../common/mac/GTMLogger.m; sourceTree = SOURCE_ROOT; };
F9C77DDA0F7DD5CF0045F7DB /* UnitTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
F9C77DDB0F7DD5CF0045F7DB /* UnitTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UnitTests-Info.plist"; sourceTree = "<group>"; };
- F9C77DE00F7DD7E30045F7DB /* SimpleStringDictionaryTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleStringDictionaryTest.h; path = tests/SimpleStringDictionaryTest.h; sourceTree = "<group>"; };
- F9C77DE10F7DD7E30045F7DB /* SimpleStringDictionaryTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SimpleStringDictionaryTest.mm; path = tests/SimpleStringDictionaryTest.mm; sourceTree = "<group>"; };
F9C77E110F7DDF810045F7DB /* GTMSenTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMSenTestCase.h; path = ../../common/mac/testing/GTMSenTestCase.h; sourceTree = SOURCE_ROOT; };
F9C77E120F7DDF810045F7DB /* GTMSenTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMSenTestCase.m; path = ../../common/mac/testing/GTMSenTestCase.m; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
@@ -936,6 +936,8 @@
F92C53870ECCE6C0009BE4BA /* convert_UTF.c */,
F92C53880ECCE6C0009BE4BA /* convert_UTF.h */,
4D72CA0D13DFAD5C006CABE3 /* md5.cc */,
+ 1EEEB6211720829E00F7E689 /* simple_string_dictionary.cc */,
+ 1EEEB6221720829E00F7E689 /* simple_string_dictionary.h */,
F92C53850ECCE6AD009BE4BA /* string_conversion.cc */,
F92C53860ECCE6AD009BE4BA /* string_conversion.h */,
F92C53840ECCE68D009BE4BA /* mac */,
@@ -967,8 +969,6 @@
F92C537D0ECCE635009BE4BA /* macho_utilities.h */,
F92C537E0ECCE635009BE4BA /* macho_walker.cc */,
F92C537F0ECCE635009BE4BA /* macho_walker.h */,
- F92C53800ECCE635009BE4BA /* SimpleStringDictionary.h */,
- F92C53810ECCE635009BE4BA /* SimpleStringDictionary.mm */,
F92C53820ECCE635009BE4BA /* string_utilities.cc */,
F92C53830ECCE635009BE4BA /* string_utilities.h */,
);
@@ -1116,12 +1116,11 @@
F9C77DDF0F7DD7CF0045F7DB /* tests */ = {
isa = PBXGroup;
children = (
+ 1EEEB6251720830600F7E689 /* simple_string_dictionary_unittest.cc */,
D23F4B9A12A8688800686C8D /* minidump_generator_test_helper.cc */,
D23F4B2C12A7E13200686C8D /* minidump_generator_test.cc */,
D2F9A4CE121336F7002747C1 /* crash_generation_server_test.cc */,
D2F9A3D41212F87C002747C1 /* exception_handler_test.cc */,
- F9C77DE00F7DD7E30045F7DB /* SimpleStringDictionaryTest.h */,
- F9C77DE10F7DD7E30045F7DB /* SimpleStringDictionaryTest.mm */,
F91AF5CF0FD60393009D8BE2 /* BreakpadFramework_Test.mm */,
);
name = tests;
@@ -1151,6 +1150,7 @@
163201D61443019E00C4DBF5 /* ConfigFile.h in Headers */,
16C7C918147D45AE00776EAD /* BreakpadDefines.h in Headers */,
162F64F3161C577500CD68D5 /* arch_utilities.h in Headers */,
+ 1EEEB6241720829E00F7E689 /* simple_string_dictionary.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1676,6 +1676,7 @@
D2F9A4CD121336C7002747C1 /* crash_generation_server.cc in Sources */,
163201D71443019E00C4DBF5 /* ConfigFile.mm in Sources */,
162F64F2161C577500CD68D5 /* arch_utilities.cc in Sources */,
+ 1EEEB6231720829E00F7E689 /* simple_string_dictionary.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1770,7 +1771,6 @@
4D72CA0E13DFAD5C006CABE3 /* md5.cc in Sources */,
F92C56460ECD10CA009BE4BA /* minidump_file_writer.cc in Sources */,
F92C56470ECD10CA009BE4BA /* minidump_generator.cc in Sources */,
- F92C56480ECD10CA009BE4BA /* SimpleStringDictionary.mm in Sources */,
F92C56490ECD10CA009BE4BA /* string_utilities.cc in Sources */,
F92C564A0ECD10CA009BE4BA /* string_conversion.cc in Sources */,
4D61A25F14F43CFC002D5862 /* bootstrap_compat.cc in Sources */,
@@ -1814,6 +1814,8 @@
D23F4B2E12A7E13200686C8D /* minidump_generator_test.cc in Sources */,
4D72CA2F13DFAE65006CABE3 /* md5.cc in Sources */,
4D61A26D14F43D43002D5862 /* bootstrap_compat.cc in Sources */,
+ 1EEEB62B1720868C00F7E689 /* simple_string_dictionary.cc in Sources */,
+ 1EEEB62A1720859200F7E689 /* simple_string_dictionary_unittest.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1855,6 +1857,7 @@
D244540B12439BA0009BBCE0 /* memory_unittest.cc in Sources */,
4D72CA3813DFAE91006CABE3 /* md5.cc in Sources */,
4D61A26E14F43D45002D5862 /* bootstrap_compat.cc in Sources */,
+ 1EEEB6271720831E00F7E689 /* BreakpadFramework_Test.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1872,10 +1875,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- F9C77DE40F7DD82F0045F7DB /* SimpleStringDictionary.mm in Sources */,
- F9C77DE20F7DD7E30045F7DB /* SimpleStringDictionaryTest.mm in Sources */,
F9C77E130F7DDF810045F7DB /* GTMSenTestCase.m in Sources */,
- F91AF5D00FD60393009D8BE2 /* BreakpadFramework_Test.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm
index 4762516e..71555e8f 100644
--- a/src/client/mac/Framework/Breakpad.mm
+++ b/src/client/mac/Framework/Breakpad.mm
@@ -52,7 +52,7 @@
#import "client/mac/Framework/OnDemandServer.h"
#import "client/mac/handler/protected_memory_allocator.h"
#import "common/mac/MachIPC.h"
-#import "common/mac/SimpleStringDictionary.h"
+#import "common/simple_string_dictionary.h"
#ifndef __EXCEPTIONS
// This file uses C++ try/catch (but shouldn't). Duplicate the macros from
diff --git a/src/client/mac/crash_generation/ConfigFile.h b/src/client/mac/crash_generation/ConfigFile.h
index f0575339..5662e8b0 100644
--- a/src/client/mac/crash_generation/ConfigFile.h
+++ b/src/client/mac/crash_generation/ConfigFile.h
@@ -31,7 +31,7 @@
#import <Foundation/Foundation.h>
-#import "common/mac/SimpleStringDictionary.h"
+#include "common/simple_string_dictionary.h"
namespace google_breakpad {
diff --git a/src/client/mac/crash_generation/ConfigFile.mm b/src/client/mac/crash_generation/ConfigFile.mm
index ee2d9448..0b7f0e15 100644
--- a/src/client/mac/crash_generation/ConfigFile.mm
+++ b/src/client/mac/crash_generation/ConfigFile.mm
@@ -36,7 +36,6 @@
#include <sys/time.h>
#import "client/apple/Framework/BreakpadDefines.h"
-#import "common/mac/SimpleStringDictionary.h"
#import "GTMDefines.h"
#define VERBOSE 0
diff --git a/src/client/mac/crash_generation/Inspector.h b/src/client/mac/crash_generation/Inspector.h
index 11a0dec6..890e2157 100644
--- a/src/client/mac/crash_generation/Inspector.h
+++ b/src/client/mac/crash_generation/Inspector.h
@@ -30,7 +30,7 @@
// Interface file between the Breakpad.framework and
// the Inspector process.
-#import "common/mac/SimpleStringDictionary.h"
+#include "common/simple_string_dictionary.h"
#import <Foundation/Foundation.h>
#include <mach/mach.h>
diff --git a/src/client/mac/crash_generation/Inspector.mm b/src/client/mac/crash_generation/Inspector.mm
index ea5d19a6..c6259121 100644
--- a/src/client/mac/crash_generation/Inspector.mm
+++ b/src/client/mac/crash_generation/Inspector.mm
@@ -41,7 +41,6 @@
#import "client/mac/Framework/Breakpad.h"
#import "client/mac/handler/minidump_generator.h"
-#import "common/mac/SimpleStringDictionary.h"
#import "common/mac/MachIPC.h"
#include "common/mac/bootstrap_compat.h"
diff --git a/src/client/mac/tests/SimpleStringDictionaryTest.h b/src/client/mac/tests/SimpleStringDictionaryTest.h
deleted file mode 100644
index 53f6ae42..00000000
--- a/src/client/mac/tests/SimpleStringDictionaryTest.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#import "GTMSenTestCase.h"
-#import "SimpleStringDictionary.h"
-
-@interface SimpleStringDictionaryTest : GTMTestCase {
-
-}
-
-- (void)testKeyValueEntry;
-- (void)testSimpleStringDictionary;
-- (void)testSimpleStringDictionaryIterator;
-@end
diff --git a/src/common/mac/SimpleStringDictionary.mm b/src/common/simple_string_dictionary.cc
index b97b760c..f28ee9ef 100644
--- a/src/common/mac/SimpleStringDictionary.mm
+++ b/src/common/simple_string_dictionary.cc
@@ -26,14 +26,10 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// SimpleStringDictionary.mm
-// Simple string dictionary that does not allocate memory
-//
#include <assert.h>
-#import "SimpleStringDictionary.h"
+#include "common/simple_string_dictionary.h"
namespace google_breakpad {
@@ -50,7 +46,7 @@ int SimpleStringDictionary::GetCount() const {
++count;
}
}
-
+
return count;
}
@@ -82,18 +78,18 @@ void SimpleStringDictionary::SetKeyValue(const char *key,
assert(key);
if (!key)
return;
-
+
// key must not be empty string
assert(key[0] != '\0');
if (key[0] == '\0')
return;
-
+
int free_index = -1;
-
+
// check if key already exists
for (int i = 0; i < MAX_NUM_ENTRIES; ++i) {
KeyValueEntry &entry = entries_[i];
-
+
if (entry.IsActive()) {
if (!strcmp(entry.GetKey(), key)) {
entry.SetValue(value);
@@ -106,10 +102,10 @@ void SimpleStringDictionary::SetKeyValue(const char *key,
}
}
}
-
+
// check if we've run out of space
assert(free_index != -1);
-
+
// Put new key into an empty slot (if found)
if (free_index != -1) {
entries_[free_index].SetKeyValue(key, value);
diff --git a/src/common/mac/SimpleStringDictionary.h b/src/common/simple_string_dictionary.h
index 814a6f7a..dbeaabc0 100644
--- a/src/common/mac/SimpleStringDictionary.h
+++ b/src/common/simple_string_dictionary.h
@@ -26,12 +26,9 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// SimpleStringDictionary.h
-//
-#ifndef SimpleStringDictionary_H__
-#define SimpleStringDictionary_H__
+#ifndef COMMON_SIMPLE_STRING_DICTIONARY_H_
+#define COMMON_SIMPLE_STRING_DICTIONARY_H_
#import <string>
#import <vector>
@@ -70,37 +67,37 @@ class KeyValueEntry {
KeyValueEntry() {
Clear();
}
-
+
KeyValueEntry(const char *key, const char *value) {
SetKeyValue(key, value);
}
- void SetKeyValue(const char *key, const char *value) {
+ void SetKeyValue(const char *key, const char *value) {
if (!key) {
key = "";
}
if (!value) {
value = "";
}
-
+
strlcpy(key_, key, sizeof(key_));
strlcpy(value_, value, sizeof(value_));
- }
+ }
- void SetValue(const char *value) {
+ void SetValue(const char *value) {
if (!value) {
value = "";
}
strlcpy(value_, value, sizeof(value_));
};
-
+
// Removes the key/value
- void Clear() {
+ void Clear() {
memset(key_, 0, sizeof(key_));
memset(value_, 0, sizeof(value_));
}
- bool IsActive() const { return key_[0] != '\0'; }
+ bool IsActive() const { return key_[0] != '\0'; }
const char *GetKey() const { return key_; }
const char *GetValue() const { return value_; }
@@ -108,7 +105,7 @@ class KeyValueEntry {
// of MachMessage (in MachIPC.h)
// (see also struct KeyValueMessageData in Inspector.h)
enum {MAX_STRING_STORAGE_SIZE = 256};
-
+
private:
char key_[MAX_STRING_STORAGE_SIZE];
char value_[MAX_STRING_STORAGE_SIZE];
@@ -126,7 +123,7 @@ class KeyValueEntry {
class SimpleStringDictionary {
public:
SimpleStringDictionary() {}; // entries will all be cleared
-
+
// Returns the number of active key/value pairs. The upper limit for this
// is MAX_NUM_ENTRIES.
int GetCount() const;
@@ -135,12 +132,12 @@ class SimpleStringDictionary {
// If |key| is NULL, an assert will fire or NULL will be returned. If |key|
// is not found or is an empty string, NULL is returned.
const char *GetValueForKey(const char *key) const;
-
+
// Stores a string |value| represented by |key|. If |key| is NULL or an empty
// string, this will assert (or do nothing). If |value| is NULL then
// the |key| will be removed. An empty string is OK for |value|.
void SetKeyValue(const char *key, const char *value);
-
+
// Given |key|, removes any associated value. It will assert (or do nothing)
// if NULL is passed in. It will do nothing if |key| is not found.
void RemoveKey(const char *key);
@@ -155,7 +152,7 @@ class SimpleStringDictionary {
const KeyValueEntry *GetEntry(int i) const;
- KeyValueEntry entries_[MAX_NUM_ENTRIES];
+ KeyValueEntry entries_[MAX_NUM_ENTRIES];
};
//==============================================================================
@@ -169,7 +166,7 @@ class SimpleStringDictionaryIterator {
void Start() {
i_ = 0;
}
-
+
// like the nextObject method of NSEnumerator (in Cocoa)
// returns NULL when there are no more entries
//
@@ -184,12 +181,12 @@ class SimpleStringDictionaryIterator {
return NULL; // reached end of array
}
-
+
private:
- const SimpleStringDictionary& dict_;
- int i_;
+ const SimpleStringDictionary& dict_;
+ int i_;
};
} // namespace google_breakpad
-#endif // SimpleStringDictionary_H__
+#endif // COMMON_SIMPLE_STRING_DICTIONARY_H_
diff --git a/src/client/mac/tests/SimpleStringDictionaryTest.mm b/src/common/simple_string_dictionary_unittest.cc
index 94179cd2..ff02115e 100644
--- a/src/client/mac/tests/SimpleStringDictionaryTest.mm
+++ b/src/common/simple_string_dictionary_unittest.cc
@@ -27,105 +27,83 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#import "SimpleStringDictionaryTest.h"
-#import "SimpleStringDictionary.h"
+#include "breakpad_googletest_includes.h"
+#include "common/simple_string_dictionary.h"
-using google_breakpad::KeyValueEntry;
-using google_breakpad::SimpleStringDictionary;
-using google_breakpad::SimpleStringDictionaryIterator;
-
-@implementation SimpleStringDictionaryTest
+namespace google_breakpad {
//==============================================================================
-- (void)testKeyValueEntry {
+TEST(SimpleStringDictionaryTest, KeyValueEntry) {
KeyValueEntry entry;
// Verify that initial state is correct
- STAssertFalse(entry.IsActive(), @"Initial key value entry is active!");
- STAssertEquals(strlen(entry.GetKey()), (size_t)0, @"Empty key value did not "
- @"have length 0");
- STAssertEquals(strlen(entry.GetValue()), (size_t)0, @"Empty key value did not "
- @"have length 0");
+ EXPECT_FALSE(entry.IsActive());
+ EXPECT_EQ(strlen(entry.GetKey()), 0u);
+ EXPECT_EQ(strlen(entry.GetValue()), 0u);
// Try setting a key/value and then verify
entry.SetKeyValue("key1", "value1");
- STAssertEqualCStrings(entry.GetKey(), "key1", @"key was not equal to key1");
- STAssertEqualCStrings(entry.GetValue(), "value1", @"value was not equal");
+ EXPECT_STREQ(entry.GetKey(), "key1");
+ EXPECT_STREQ(entry.GetValue(), "value1");
// Try setting a new value
entry.SetValue("value3");
// Make sure the new value took
- STAssertEqualCStrings(entry.GetValue(), "value3", @"value was not equal");
+ EXPECT_STREQ(entry.GetValue(), "value3");
// Make sure the key didn't change
- STAssertEqualCStrings(entry.GetKey(), "key1", @"key changed after setting "
- @"value!");
+ EXPECT_STREQ(entry.GetKey(), "key1");
// Try setting a new key/value and then verify
entry.SetKeyValue("key2", "value2");
- STAssertEqualCStrings(entry.GetKey(), "key2", @"New key was not equal to "
- @"key2");
- STAssertEqualCStrings(entry.GetValue(), "value2", @"New value was not equal "
- @"to value2");
+ EXPECT_STREQ(entry.GetKey(), "key2");
+ EXPECT_STREQ(entry.GetValue(), "value2");
// Clear the entry and verify the key and value are empty strings
entry.Clear();
- STAssertFalse(entry.IsActive(), @"Key value clear did not clear object");
- STAssertEquals(strlen(entry.GetKey()), (size_t)0, @"Length of cleared key "
- @"was not 0");
- STAssertEquals(strlen(entry.GetValue()), (size_t)0, @"Length of cleared "
- @"value was not 0!");
+ EXPECT_FALSE(entry.IsActive());
+ EXPECT_EQ(strlen(entry.GetKey()), 0u);
+ EXPECT_EQ(strlen(entry.GetValue()), 0u);
}
-- (void)testEmptyKeyValueCombos {
+TEST(SimpleStringDictionaryTest, EmptyKeyValueCombos) {
KeyValueEntry entry;
entry.SetKeyValue(NULL, NULL);
- STAssertEqualCStrings(entry.GetKey(), "", @"Setting NULL key did not return "
- @"empty key!");
- STAssertEqualCStrings(entry.GetValue(), "", @"Setting NULL value did not "
- @"set empty string value!");
+ EXPECT_STREQ(entry.GetKey(), "");
+ EXPECT_STREQ(entry.GetValue(), "");
}
//==============================================================================
-- (void)testSimpleStringDictionary {
+TEST(SimpleStringDictionaryTest, SimpleStringDictionary) {
// Make a new dictionary
SimpleStringDictionary *dict = new SimpleStringDictionary();
- STAssertTrue(dict != NULL, nil);
-
- // try passing in NULL for key
- //dict->SetKeyValue(NULL, "bad"); // causes assert() to fire
+ ASSERT_TRUE(dict);
// Set three distinct values on three keys
dict->SetKeyValue("key1", "value1");
dict->SetKeyValue("key2", "value2");
dict->SetKeyValue("key3", "value3");
- STAssertTrue(!strcmp(dict->GetValueForKey("key1"), "value1"), nil);
- STAssertTrue(!strcmp(dict->GetValueForKey("key2"), "value2"), nil);
- STAssertTrue(!strcmp(dict->GetValueForKey("key3"), "value3"), nil);
- STAssertEquals(dict->GetCount(), 3, @"GetCount did not return 3");
+ EXPECT_NE(dict->GetValueForKey("key1"), "value1");
+ EXPECT_NE(dict->GetValueForKey("key2"), "value2");
+ EXPECT_NE(dict->GetValueForKey("key3"), "value3");
+ EXPECT_EQ(dict->GetCount(), 3);
// try an unknown key
- STAssertTrue(dict->GetValueForKey("key4") == NULL, nil);
-
- // try a NULL key
- //STAssertTrue(dict->GetValueForKey(NULL) == NULL, nil); // asserts
+ EXPECT_FALSE(dict->GetValueForKey("key4"));
// Remove a key
dict->RemoveKey("key3");
// Now make sure it's not there anymore
- STAssertTrue(dict->GetValueForKey("key3") == NULL, nil);
-
- // Remove a NULL key
- //dict->RemoveKey(NULL); // will cause assert() to fire
+ EXPECT_FALSE(dict->GetValueForKey("key3"));
// Remove by setting value to NULL
dict->SetKeyValue("key2", NULL);
// Now make sure it's not there anymore
- STAssertTrue(dict->GetValueForKey("key2") == NULL, nil);
+ EXPECT_FALSE(dict->GetValueForKey("key2"));
}
//==============================================================================
@@ -139,9 +117,9 @@ using google_breakpad::SimpleStringDictionaryIterator;
//
// key<n>/value<n> (like key0/value0, key17,value17, etc.)
//
-- (void)testSimpleStringDictionaryIterator {
+TEST(SimpleStringDictionaryTest, SimpleStringDictionaryIterator) {
SimpleStringDictionary *dict = new SimpleStringDictionary();
- STAssertTrue(dict != NULL, nil);
+ ASSERT_TRUE(dict);
char key[KeyValueEntry::MAX_STRING_STORAGE_SIZE];
char value[KeyValueEntry::MAX_STRING_STORAGE_SIZE];
@@ -150,7 +128,7 @@ using google_breakpad::SimpleStringDictionaryIterator;
const int kPartitionIndex = kDictionaryCapacity - 5;
// We assume at least this size in the tests below
- STAssertTrue(kDictionaryCapacity >= 64, nil);
+ ASSERT_GE(kDictionaryCapacity, 64);
// We'll keep track of the number of key/value pairs we think should
// be in the dictionary
@@ -211,7 +189,7 @@ using google_breakpad::SimpleStringDictionaryIterator;
sscanf(entry->GetValue(), "value%d", &valueNumber);
// The value number should equal the key number since that's how we set them
- STAssertTrue(keyNumber == valueNumber, nil);
+ EXPECT_EQ(keyNumber, valueNumber);
// Key and value numbers should be in proper range:
// 0 <= keyNumber < kDictionaryCapacity
@@ -219,8 +197,8 @@ using google_breakpad::SimpleStringDictionaryIterator;
(keyNumber >= 0 && keyNumber < kDictionaryCapacity);
bool isValueInGoodRange =
(valueNumber >= 0 && valueNumber < kDictionaryCapacity);
- STAssertTrue(isKeyInGoodRange, nil);
- STAssertTrue(isValueInGoodRange, nil);
+ EXPECT_TRUE(isKeyInGoodRange);
+ EXPECT_TRUE(isValueInGoodRange);
if (isKeyInGoodRange && isValueInGoodRange) {
++count[keyNumber];
@@ -232,12 +210,12 @@ using google_breakpad::SimpleStringDictionaryIterator;
for (int i = 0; i < kDictionaryCapacity; ++i) {
// Skip over key7, key18, key23, and key31, since we removed them
if (!(i == 7 || i == 18 || i == 23 || i == 31)) {
- STAssertTrue(count[i] == 1, nil);
+ EXPECT_EQ(count[i], 1);
}
}
// Make sure the number of iterations matches the expected dictionary size.
- STAssertTrue(totalCount == expectedDictionarySize, nil);
+ EXPECT_EQ(totalCount, expectedDictionarySize);
}
-@end
+} // namespace google_breakpad