Index: content/browser/cocoa/system_hotkey_map_unittest.mm |
diff --git a/chrome/browser/ui/cocoa/system_hotkey_map_unittest.mm b/content/browser/cocoa/system_hotkey_map_unittest.mm |
similarity index 58% |
rename from chrome/browser/ui/cocoa/system_hotkey_map_unittest.mm |
rename to content/browser/cocoa/system_hotkey_map_unittest.mm |
index dbcf01704843106ea3ea8b32372efb03ae2ca277..b37549fdaddc8bc6b6c754c48fad8a7edeb12990 100644 |
--- a/chrome/browser/ui/cocoa/system_hotkey_map_unittest.mm |
+++ b/content/browser/cocoa/system_hotkey_map_unittest.mm |
@@ -7,10 +7,12 @@ |
#import <Carbon/Carbon.h> |
#import <Cocoa/Cocoa.h> |
-#import "chrome/browser/ui/cocoa/system_hotkey_map.h" |
-#include "chrome/test/base/ui_test_utils.h" |
+#include "base/files/file_path.h" |
+#include "base/path_service.h" |
+#import "content/browser/cocoa/system_hotkey_map.h" |
+#include "content/public/common/content_paths.h" |
-namespace { |
+namespace content { |
class SystemHotkeyMapTest : public ::testing::Test { |
public: |
@@ -18,15 +20,22 @@ class SystemHotkeyMapTest : public ::testing::Test { |
}; |
TEST_F(SystemHotkeyMapTest, Parse) { |
- std::string path = ui_test_utils::GetTestUrl( |
- base::FilePath(base::FilePath::kCurrentDirectory), |
- base::FilePath("mac/mac_system_hotkeys.plist")).path(); |
- NSString* file_path = [NSString stringWithUTF8String:path.c_str()]; |
+ base::FilePath test_data_dir; |
+ ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_data_dir)); |
+ |
+ base::FilePath test_path = |
+ test_data_dir.AppendASCII("mac/mac_system_hotkeys.plist"); |
+ std::string test_path_string = test_path.AsUTF8Unsafe(); |
+ NSString* file_path = |
+ [NSString stringWithUTF8String:test_path_string.c_str()]; |
NSData* data = [NSData dataWithContentsOfFile:file_path]; |
ASSERT_TRUE(data); |
+ NSDictionary* dictionary = SystemHotkeyMap::DictionaryFromData(data); |
+ ASSERT_TRUE(dictionary); |
+ |
SystemHotkeyMap map; |
- bool result = map.ParseData(data); |
+ bool result = map.ParseDictionary(dictionary); |
EXPECT_TRUE(result); |
// Command + ` is a common key binding. It should exist. |
@@ -48,4 +57,12 @@ TEST_F(SystemHotkeyMapTest, Parse) { |
EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); |
} |
-} // namespace |
+TEST_F(SystemHotkeyMapTest, ParseNil) { |
+ NSDictionary* dictionary = nil; |
+ |
+ SystemHotkeyMap map; |
+ bool result = map.ParseDictionary(dictionary); |
+ EXPECT_FALSE(result); |
+} |
+ |
+} // namespace content |