summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-18 06:14:59 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-18 06:14:59 +0000
commit631a54712d79c39bb7fbd322e3e4dc6b2429686d (patch)
treeecefa4d7d12d7dd79e489065c2555781bab9b5f5 /base
parente541ac7357c2178ee785764ab0415f94f5ec9bd7 (diff)
downloadchromium_src-631a54712d79c39bb7fbd322e3e4dc6b2429686d.zip
chromium_src-631a54712d79c39bb7fbd322e3e4dc6b2429686d.tar.gz
chromium_src-631a54712d79c39bb7fbd322e3e4dc6b2429686d.tar.bz2
Fix more remaining FilePath -> base::FilePath.
This removes the "using" in file_path.h for Mac since Mac now passes trybots with no using. It still leaves the using for Windows. Review URL: https://codereview.chromium.org/12294008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183066 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base_paths_win.cc2
-rw-r--r--base/file_path.h2
-rw-r--r--base/file_util_win.cc2
-rw-r--r--base/file_version_info_unittest.cc2
-rw-r--r--base/file_version_info_win.cc2
-rw-r--r--base/i18n/icu_util.cc2
-rw-r--r--base/mac/foundation_util_unittest.mm348
-rw-r--r--base/win/event_trace_consumer_unittest.cc26
-rw-r--r--base/win/event_trace_controller_unittest.cc19
-rw-r--r--base/win/shortcut_unittest.cc158
10 files changed, 283 insertions, 280 deletions
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc
index a06d908..bd4c791 100644
--- a/base/base_paths_win.cc
+++ b/base/base_paths_win.cc
@@ -16,6 +16,8 @@
// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
extern "C" IMAGE_DOS_HEADER __ImageBase;
+using base::FilePath;
+
namespace {
bool GetQuickLaunchPath(bool default_user, FilePath* result) {
diff --git a/base/file_path.h b/base/file_path.h
index c01da94..707d4ab 100644
--- a/base/file_path.h
+++ b/base/file_path.h
@@ -408,7 +408,7 @@ class BASE_EXPORT FilePath {
// http://crosbug.com/39008 MTPD has a circular dependency on base and uses the
// old non-namespaced FilePath.
#if defined(MTPD_DEVICE_MANAGER_H_) || defined(OS_CHROMEOS) || \
- !defined(OS_LINUX)
+ (!defined(OS_LINUX) && !defined(OS_MAXOSX))
using base::FilePath;
#endif
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 65fd6eb..199a7cf 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -25,6 +25,8 @@
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
+using base::FilePath;
+
namespace file_util {
namespace {
diff --git a/base/file_version_info_unittest.cc b/base/file_version_info_unittest.cc
index 916e7bc5..515297b3 100644
--- a/base/file_version_info_unittest.cc
+++ b/base/file_version_info_unittest.cc
@@ -12,6 +12,8 @@
#include "base/file_version_info_win.h"
#endif
+using base::FilePath;
+
namespace {
#if defined(OS_WIN)
diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc
index 6528ca3..e5cd5f7 100644
--- a/base/file_version_info_win.cc
+++ b/base/file_version_info_win.cc
@@ -12,6 +12,8 @@
#include "base/path_service.h"
#include "base/threading/thread_restrictions.h"
+using base::FilePath;
+
FileVersionInfoWin::FileVersionInfoWin(void* data, int language, int code_page)
: language_(language), code_page_(code_page) {
base::ThreadRestrictions::AssertIOAllowed();
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index 3cfd1d1..25fe8c1 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -50,6 +50,8 @@
#endif
#endif
+using base::FilePath;
+
namespace icu_util {
bool Initialize() {
diff --git a/base/mac/foundation_util_unittest.mm b/base/mac/foundation_util_unittest.mm
index e5577ec..6fb85d8 100644
--- a/base/mac/foundation_util_unittest.mm
+++ b/base/mac/foundation_util_unittest.mm
@@ -11,45 +11,46 @@
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
+namespace base {
+namespace mac {
+
TEST(FoundationUtilTest, CFCast) {
// Build out the CF types to be tested as empty containers.
- base::mac::ScopedCFTypeRef<CFTypeRef> test_array(
+ ScopedCFTypeRef<CFTypeRef> test_array(
CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_array_mutable(
+ ScopedCFTypeRef<CFTypeRef> test_array_mutable(
CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_bag(
+ ScopedCFTypeRef<CFTypeRef> test_bag(
CFBagCreate(NULL, NULL, 0, &kCFTypeBagCallBacks));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_bag_mutable(
+ ScopedCFTypeRef<CFTypeRef> test_bag_mutable(
CFBagCreateMutable(NULL, 0, &kCFTypeBagCallBacks));
CFTypeRef test_bool = kCFBooleanTrue;
- base::mac::ScopedCFTypeRef<CFTypeRef> test_data(
+ ScopedCFTypeRef<CFTypeRef> test_data(
CFDataCreate(NULL, NULL, 0));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_data_mutable(
+ ScopedCFTypeRef<CFTypeRef> test_data_mutable(
CFDataCreateMutable(NULL, 0));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_date(
+ ScopedCFTypeRef<CFTypeRef> test_date(
CFDateCreate(NULL, 0));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_dict(
+ ScopedCFTypeRef<CFTypeRef> test_dict(
CFDictionaryCreate(NULL, NULL, NULL, 0,
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_dict_mutable(
+ ScopedCFTypeRef<CFTypeRef> test_dict_mutable(
CFDictionaryCreateMutable(NULL, 0,
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
int int_val = 256;
- base::mac::ScopedCFTypeRef<CFTypeRef> test_number(
+ ScopedCFTypeRef<CFTypeRef> test_number(
CFNumberCreate(NULL, kCFNumberIntType, &int_val));
CFTypeRef test_null = kCFNull;
- base::mac::ScopedCFTypeRef<CFTypeRef> test_set(
+ ScopedCFTypeRef<CFTypeRef> test_set(
CFSetCreate(NULL, NULL, 0, &kCFTypeSetCallBacks));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_set_mutable(
+ ScopedCFTypeRef<CFTypeRef> test_set_mutable(
CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks));
- base::mac::ScopedCFTypeRef<CFTypeRef> test_str(
- CFStringCreateWithBytes(NULL, NULL, 0, kCFStringEncodingASCII,
- false));
+ ScopedCFTypeRef<CFTypeRef> test_str(
+ CFStringCreateWithBytes(NULL, NULL, 0, kCFStringEncodingASCII, false));
CFTypeRef test_str_const = CFSTR("hello");
- base::mac::ScopedCFTypeRef<CFTypeRef> test_str_mutable(
- CFStringCreateMutable(NULL, 0));
+ ScopedCFTypeRef<CFTypeRef> test_str_mutable(CFStringCreateMutable(NULL, 0));
// Make sure the allocations of CF types are good.
EXPECT_TRUE(test_array);
@@ -71,101 +72,90 @@ TEST(FoundationUtilTest, CFCast) {
EXPECT_TRUE(test_str_mutable);
// Casting the CFTypeRef objects correctly provides the same pointer.
- EXPECT_EQ(test_array, base::mac::CFCast<CFArrayRef>(test_array));
- EXPECT_EQ(test_array_mutable,
- base::mac::CFCast<CFArrayRef>(test_array_mutable));
- EXPECT_EQ(test_bag, base::mac::CFCast<CFBagRef>(test_bag));
- EXPECT_EQ(test_bag_mutable,
- base::mac::CFCast<CFBagRef>(test_bag_mutable));
- EXPECT_EQ(test_bool, base::mac::CFCast<CFBooleanRef>(test_bool));
- EXPECT_EQ(test_data, base::mac::CFCast<CFDataRef>(test_data));
- EXPECT_EQ(test_data_mutable,
- base::mac::CFCast<CFDataRef>(test_data_mutable));
- EXPECT_EQ(test_date, base::mac::CFCast<CFDateRef>(test_date));
- EXPECT_EQ(test_dict, base::mac::CFCast<CFDictionaryRef>(test_dict));
- EXPECT_EQ(test_dict_mutable,
- base::mac::CFCast<CFDictionaryRef>(test_dict_mutable));
- EXPECT_EQ(test_number, base::mac::CFCast<CFNumberRef>(test_number));
- EXPECT_EQ(test_null, base::mac::CFCast<CFNullRef>(test_null));
- EXPECT_EQ(test_set, base::mac::CFCast<CFSetRef>(test_set));
- EXPECT_EQ(test_set_mutable, base::mac::CFCast<CFSetRef>(test_set_mutable));
- EXPECT_EQ(test_str, base::mac::CFCast<CFStringRef>(test_str));
- EXPECT_EQ(test_str_const, base::mac::CFCast<CFStringRef>(test_str_const));
- EXPECT_EQ(test_str_mutable,
- base::mac::CFCast<CFStringRef>(test_str_mutable));
+ EXPECT_EQ(test_array, CFCast<CFArrayRef>(test_array));
+ EXPECT_EQ(test_array_mutable, CFCast<CFArrayRef>(test_array_mutable));
+ EXPECT_EQ(test_bag, CFCast<CFBagRef>(test_bag));
+ EXPECT_EQ(test_bag_mutable, CFCast<CFBagRef>(test_bag_mutable));
+ EXPECT_EQ(test_bool, CFCast<CFBooleanRef>(test_bool));
+ EXPECT_EQ(test_data, CFCast<CFDataRef>(test_data));
+ EXPECT_EQ(test_data_mutable, CFCast<CFDataRef>(test_data_mutable));
+ EXPECT_EQ(test_date, CFCast<CFDateRef>(test_date));
+ EXPECT_EQ(test_dict, CFCast<CFDictionaryRef>(test_dict));
+ EXPECT_EQ(test_dict_mutable, CFCast<CFDictionaryRef>(test_dict_mutable));
+ EXPECT_EQ(test_number, CFCast<CFNumberRef>(test_number));
+ EXPECT_EQ(test_null, CFCast<CFNullRef>(test_null));
+ EXPECT_EQ(test_set, CFCast<CFSetRef>(test_set));
+ EXPECT_EQ(test_set_mutable, CFCast<CFSetRef>(test_set_mutable));
+ EXPECT_EQ(test_str, CFCast<CFStringRef>(test_str));
+ EXPECT_EQ(test_str_const, CFCast<CFStringRef>(test_str_const));
+ EXPECT_EQ(test_str_mutable, CFCast<CFStringRef>(test_str_mutable));
// When given an incorrect CF cast, provide NULL.
- EXPECT_FALSE(base::mac::CFCast<CFStringRef>(test_array));
- EXPECT_FALSE(base::mac::CFCast<CFStringRef>(test_array_mutable));
- EXPECT_FALSE(base::mac::CFCast<CFStringRef>(test_bag));
- EXPECT_FALSE(base::mac::CFCast<CFSetRef>(test_bag_mutable));
- EXPECT_FALSE(base::mac::CFCast<CFSetRef>(test_bool));
- EXPECT_FALSE(base::mac::CFCast<CFNullRef>(test_data));
- EXPECT_FALSE(base::mac::CFCast<CFDictionaryRef>(test_data_mutable));
- EXPECT_FALSE(base::mac::CFCast<CFDictionaryRef>(test_date));
- EXPECT_FALSE(base::mac::CFCast<CFNumberRef>(test_dict));
- EXPECT_FALSE(base::mac::CFCast<CFDateRef>(test_dict_mutable));
- EXPECT_FALSE(base::mac::CFCast<CFDataRef>(test_number));
- EXPECT_FALSE(base::mac::CFCast<CFDataRef>(test_null));
- EXPECT_FALSE(base::mac::CFCast<CFBooleanRef>(test_set));
- EXPECT_FALSE(base::mac::CFCast<CFBagRef>(test_set_mutable));
- EXPECT_FALSE(base::mac::CFCast<CFBagRef>(test_str));
- EXPECT_FALSE(base::mac::CFCast<CFArrayRef>(test_str_const));
- EXPECT_FALSE(base::mac::CFCast<CFArrayRef>(test_str_mutable));
+ EXPECT_FALSE(CFCast<CFStringRef>(test_array));
+ EXPECT_FALSE(CFCast<CFStringRef>(test_array_mutable));
+ EXPECT_FALSE(CFCast<CFStringRef>(test_bag));
+ EXPECT_FALSE(CFCast<CFSetRef>(test_bag_mutable));
+ EXPECT_FALSE(CFCast<CFSetRef>(test_bool));
+ EXPECT_FALSE(CFCast<CFNullRef>(test_data));
+ EXPECT_FALSE(CFCast<CFDictionaryRef>(test_data_mutable));
+ EXPECT_FALSE(CFCast<CFDictionaryRef>(test_date));
+ EXPECT_FALSE(CFCast<CFNumberRef>(test_dict));
+ EXPECT_FALSE(CFCast<CFDateRef>(test_dict_mutable));
+ EXPECT_FALSE(CFCast<CFDataRef>(test_number));
+ EXPECT_FALSE(CFCast<CFDataRef>(test_null));
+ EXPECT_FALSE(CFCast<CFBooleanRef>(test_set));
+ EXPECT_FALSE(CFCast<CFBagRef>(test_set_mutable));
+ EXPECT_FALSE(CFCast<CFBagRef>(test_str));
+ EXPECT_FALSE(CFCast<CFArrayRef>(test_str_const));
+ EXPECT_FALSE(CFCast<CFArrayRef>(test_str_mutable));
// Giving a NULL provides a NULL.
- EXPECT_FALSE(base::mac::CFCast<CFArrayRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFBagRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFBooleanRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFDataRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFDateRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFDictionaryRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFNullRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFNumberRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFSetRef>(NULL));
- EXPECT_FALSE(base::mac::CFCast<CFStringRef>(NULL));
+ EXPECT_FALSE(CFCast<CFArrayRef>(NULL));
+ EXPECT_FALSE(CFCast<CFBagRef>(NULL));
+ EXPECT_FALSE(CFCast<CFBooleanRef>(NULL));
+ EXPECT_FALSE(CFCast<CFDataRef>(NULL));
+ EXPECT_FALSE(CFCast<CFDateRef>(NULL));
+ EXPECT_FALSE(CFCast<CFDictionaryRef>(NULL));
+ EXPECT_FALSE(CFCast<CFNullRef>(NULL));
+ EXPECT_FALSE(CFCast<CFNumberRef>(NULL));
+ EXPECT_FALSE(CFCast<CFSetRef>(NULL));
+ EXPECT_FALSE(CFCast<CFStringRef>(NULL));
// CFCastStrict: correct cast results in correct pointer being returned.
- EXPECT_EQ(test_array, base::mac::CFCastStrict<CFArrayRef>(test_array));
- EXPECT_EQ(test_array_mutable,
- base::mac::CFCastStrict<CFArrayRef>(test_array_mutable));
- EXPECT_EQ(test_bag, base::mac::CFCastStrict<CFBagRef>(test_bag));
- EXPECT_EQ(test_bag_mutable,
- base::mac::CFCastStrict<CFBagRef>(test_bag_mutable));
- EXPECT_EQ(test_bool, base::mac::CFCastStrict<CFBooleanRef>(test_bool));
- EXPECT_EQ(test_data, base::mac::CFCastStrict<CFDataRef>(test_data));
- EXPECT_EQ(test_data_mutable,
- base::mac::CFCastStrict<CFDataRef>(test_data_mutable));
- EXPECT_EQ(test_date, base::mac::CFCastStrict<CFDateRef>(test_date));
- EXPECT_EQ(test_dict, base::mac::CFCastStrict<CFDictionaryRef>(test_dict));
+ EXPECT_EQ(test_array, CFCastStrict<CFArrayRef>(test_array));
+ EXPECT_EQ(test_array_mutable, CFCastStrict<CFArrayRef>(test_array_mutable));
+ EXPECT_EQ(test_bag, CFCastStrict<CFBagRef>(test_bag));
+ EXPECT_EQ(test_bag_mutable, CFCastStrict<CFBagRef>(test_bag_mutable));
+ EXPECT_EQ(test_bool, CFCastStrict<CFBooleanRef>(test_bool));
+ EXPECT_EQ(test_data, CFCastStrict<CFDataRef>(test_data));
+ EXPECT_EQ(test_data_mutable, CFCastStrict<CFDataRef>(test_data_mutable));
+ EXPECT_EQ(test_date, CFCastStrict<CFDateRef>(test_date));
+ EXPECT_EQ(test_dict, CFCastStrict<CFDictionaryRef>(test_dict));
EXPECT_EQ(test_dict_mutable,
- base::mac::CFCastStrict<CFDictionaryRef>(test_dict_mutable));
- EXPECT_EQ(test_number, base::mac::CFCastStrict<CFNumberRef>(test_number));
- EXPECT_EQ(test_null, base::mac::CFCastStrict<CFNullRef>(test_null));
- EXPECT_EQ(test_set, base::mac::CFCastStrict<CFSetRef>(test_set));
- EXPECT_EQ(test_set_mutable,
- base::mac::CFCastStrict<CFSetRef>(test_set_mutable));
- EXPECT_EQ(test_str, base::mac::CFCastStrict<CFStringRef>(test_str));
- EXPECT_EQ(test_str_const,
- base::mac::CFCastStrict<CFStringRef>(test_str_const));
- EXPECT_EQ(test_str_mutable,
- base::mac::CFCastStrict<CFStringRef>(test_str_mutable));
+ CFCastStrict<CFDictionaryRef>(test_dict_mutable));
+ EXPECT_EQ(test_number, CFCastStrict<CFNumberRef>(test_number));
+ EXPECT_EQ(test_null, CFCastStrict<CFNullRef>(test_null));
+ EXPECT_EQ(test_set, CFCastStrict<CFSetRef>(test_set));
+ EXPECT_EQ(test_set_mutable, CFCastStrict<CFSetRef>(test_set_mutable));
+ EXPECT_EQ(test_str, CFCastStrict<CFStringRef>(test_str));
+ EXPECT_EQ(test_str_const, CFCastStrict<CFStringRef>(test_str_const));
+ EXPECT_EQ(test_str_mutable, CFCastStrict<CFStringRef>(test_str_mutable));
// CFCastStrict: Giving a NULL provides a NULL.
- EXPECT_FALSE(base::mac::CFCastStrict<CFArrayRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFBagRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFBooleanRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFDataRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFDateRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFDictionaryRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFNullRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFNumberRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFSetRef>(NULL));
- EXPECT_FALSE(base::mac::CFCastStrict<CFStringRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFArrayRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFBagRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFBooleanRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFDataRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFDateRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFDictionaryRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFNullRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFNumberRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFSetRef>(NULL));
+ EXPECT_FALSE(CFCastStrict<CFStringRef>(NULL));
}
TEST(FoundationUtilTest, ObjCCast) {
- base::mac::ScopedNSAutoreleasePool pool;
+ ScopedNSAutoreleasePool pool;
id test_array = [NSArray array];
id test_array_mutable = [NSMutableArray array];
@@ -201,92 +191,88 @@ TEST(FoundationUtilTest, ObjCCast) {
EXPECT_TRUE(test_str_mutable);
// Casting the id correctly provides the same pointer.
- EXPECT_EQ(test_array, base::mac::ObjCCast<NSArray>(test_array));
- EXPECT_EQ(test_array_mutable,
- base::mac::ObjCCast<NSArray>(test_array_mutable));
- EXPECT_EQ(test_data, base::mac::ObjCCast<NSData>(test_data));
- EXPECT_EQ(test_data_mutable,
- base::mac::ObjCCast<NSData>(test_data_mutable));
- EXPECT_EQ(test_date, base::mac::ObjCCast<NSDate>(test_date));
- EXPECT_EQ(test_dict, base::mac::ObjCCast<NSDictionary>(test_dict));
- EXPECT_EQ(test_dict_mutable,
- base::mac::ObjCCast<NSDictionary>(test_dict_mutable));
- EXPECT_EQ(test_number, base::mac::ObjCCast<NSNumber>(test_number));
- EXPECT_EQ(test_null, base::mac::ObjCCast<NSNull>(test_null));
- EXPECT_EQ(test_set, base::mac::ObjCCast<NSSet>(test_set));
- EXPECT_EQ(test_set_mutable, base::mac::ObjCCast<NSSet>(test_set_mutable));
- EXPECT_EQ(test_str, base::mac::ObjCCast<NSString>(test_str));
- EXPECT_EQ(test_str_const, base::mac::ObjCCast<NSString>(test_str_const));
- EXPECT_EQ(test_str_mutable,
- base::mac::ObjCCast<NSString>(test_str_mutable));
+ EXPECT_EQ(test_array, ObjCCast<NSArray>(test_array));
+ EXPECT_EQ(test_array_mutable, ObjCCast<NSArray>(test_array_mutable));
+ EXPECT_EQ(test_data, ObjCCast<NSData>(test_data));
+ EXPECT_EQ(test_data_mutable, ObjCCast<NSData>(test_data_mutable));
+ EXPECT_EQ(test_date, ObjCCast<NSDate>(test_date));
+ EXPECT_EQ(test_dict, ObjCCast<NSDictionary>(test_dict));
+ EXPECT_EQ(test_dict_mutable, ObjCCast<NSDictionary>(test_dict_mutable));
+ EXPECT_EQ(test_number, ObjCCast<NSNumber>(test_number));
+ EXPECT_EQ(test_null, ObjCCast<NSNull>(test_null));
+ EXPECT_EQ(test_set, ObjCCast<NSSet>(test_set));
+ EXPECT_EQ(test_set_mutable, ObjCCast<NSSet>(test_set_mutable));
+ EXPECT_EQ(test_str, ObjCCast<NSString>(test_str));
+ EXPECT_EQ(test_str_const, ObjCCast<NSString>(test_str_const));
+ EXPECT_EQ(test_str_mutable, ObjCCast<NSString>(test_str_mutable));
// When given an incorrect ObjC cast, provide nil.
- EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_array));
- EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_array_mutable));
- EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_data));
- EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_data_mutable));
- EXPECT_FALSE(base::mac::ObjCCast<NSSet>(test_date));
- EXPECT_FALSE(base::mac::ObjCCast<NSSet>(test_dict));
- EXPECT_FALSE(base::mac::ObjCCast<NSNumber>(test_dict_mutable));
- EXPECT_FALSE(base::mac::ObjCCast<NSNull>(test_number));
- EXPECT_FALSE(base::mac::ObjCCast<NSDictionary>(test_null));
- EXPECT_FALSE(base::mac::ObjCCast<NSDictionary>(test_set));
- EXPECT_FALSE(base::mac::ObjCCast<NSDate>(test_set_mutable));
- EXPECT_FALSE(base::mac::ObjCCast<NSData>(test_str));
- EXPECT_FALSE(base::mac::ObjCCast<NSData>(test_str_const));
- EXPECT_FALSE(base::mac::ObjCCast<NSArray>(test_str_mutable));
+ EXPECT_FALSE(ObjCCast<NSString>(test_array));
+ EXPECT_FALSE(ObjCCast<NSString>(test_array_mutable));
+ EXPECT_FALSE(ObjCCast<NSString>(test_data));
+ EXPECT_FALSE(ObjCCast<NSString>(test_data_mutable));
+ EXPECT_FALSE(ObjCCast<NSSet>(test_date));
+ EXPECT_FALSE(ObjCCast<NSSet>(test_dict));
+ EXPECT_FALSE(ObjCCast<NSNumber>(test_dict_mutable));
+ EXPECT_FALSE(ObjCCast<NSNull>(test_number));
+ EXPECT_FALSE(ObjCCast<NSDictionary>(test_null));
+ EXPECT_FALSE(ObjCCast<NSDictionary>(test_set));
+ EXPECT_FALSE(ObjCCast<NSDate>(test_set_mutable));
+ EXPECT_FALSE(ObjCCast<NSData>(test_str));
+ EXPECT_FALSE(ObjCCast<NSData>(test_str_const));
+ EXPECT_FALSE(ObjCCast<NSArray>(test_str_mutable));
// Giving a nil provides a nil.
- EXPECT_FALSE(base::mac::ObjCCast<NSArray>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSData>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSDate>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSDictionary>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSNull>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSNumber>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSSet>(nil));
- EXPECT_FALSE(base::mac::ObjCCast<NSString>(nil));
+ EXPECT_FALSE(ObjCCast<NSArray>(nil));
+ EXPECT_FALSE(ObjCCast<NSData>(nil));
+ EXPECT_FALSE(ObjCCast<NSDate>(nil));
+ EXPECT_FALSE(ObjCCast<NSDictionary>(nil));
+ EXPECT_FALSE(ObjCCast<NSNull>(nil));
+ EXPECT_FALSE(ObjCCast<NSNumber>(nil));
+ EXPECT_FALSE(ObjCCast<NSSet>(nil));
+ EXPECT_FALSE(ObjCCast<NSString>(nil));
// ObjCCastStrict: correct cast results in correct pointer being returned.
- EXPECT_EQ(test_array, base::mac::ObjCCastStrict<NSArray>(test_array));
+ EXPECT_EQ(test_array, ObjCCastStrict<NSArray>(test_array));
EXPECT_EQ(test_array_mutable,
- base::mac::ObjCCastStrict<NSArray>(test_array_mutable));
- EXPECT_EQ(test_data, base::mac::ObjCCastStrict<NSData>(test_data));
+ ObjCCastStrict<NSArray>(test_array_mutable));
+ EXPECT_EQ(test_data, ObjCCastStrict<NSData>(test_data));
EXPECT_EQ(test_data_mutable,
- base::mac::ObjCCastStrict<NSData>(test_data_mutable));
- EXPECT_EQ(test_date, base::mac::ObjCCastStrict<NSDate>(test_date));
- EXPECT_EQ(test_dict, base::mac::ObjCCastStrict<NSDictionary>(test_dict));
+ ObjCCastStrict<NSData>(test_data_mutable));
+ EXPECT_EQ(test_date, ObjCCastStrict<NSDate>(test_date));
+ EXPECT_EQ(test_dict, ObjCCastStrict<NSDictionary>(test_dict));
EXPECT_EQ(test_dict_mutable,
- base::mac::ObjCCastStrict<NSDictionary>(test_dict_mutable));
- EXPECT_EQ(test_number, base::mac::ObjCCastStrict<NSNumber>(test_number));
- EXPECT_EQ(test_null, base::mac::ObjCCastStrict<NSNull>(test_null));
- EXPECT_EQ(test_set, base::mac::ObjCCastStrict<NSSet>(test_set));
+ ObjCCastStrict<NSDictionary>(test_dict_mutable));
+ EXPECT_EQ(test_number, ObjCCastStrict<NSNumber>(test_number));
+ EXPECT_EQ(test_null, ObjCCastStrict<NSNull>(test_null));
+ EXPECT_EQ(test_set, ObjCCastStrict<NSSet>(test_set));
EXPECT_EQ(test_set_mutable,
- base::mac::ObjCCastStrict<NSSet>(test_set_mutable));
- EXPECT_EQ(test_str, base::mac::ObjCCastStrict<NSString>(test_str));
+ ObjCCastStrict<NSSet>(test_set_mutable));
+ EXPECT_EQ(test_str, ObjCCastStrict<NSString>(test_str));
EXPECT_EQ(test_str_const,
- base::mac::ObjCCastStrict<NSString>(test_str_const));
+ ObjCCastStrict<NSString>(test_str_const));
EXPECT_EQ(test_str_mutable,
- base::mac::ObjCCastStrict<NSString>(test_str_mutable));
+ ObjCCastStrict<NSString>(test_str_mutable));
// ObjCCastStrict: Giving a nil provides a nil.
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSArray>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSData>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSDate>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSDictionary>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSNull>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSNumber>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSSet>(nil));
- EXPECT_FALSE(base::mac::ObjCCastStrict<NSString>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSArray>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSData>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSDate>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSDictionary>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSNull>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSNumber>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSSet>(nil));
+ EXPECT_FALSE(ObjCCastStrict<NSString>(nil));
}
TEST(FoundationUtilTest, GetValueFromDictionary) {
int one = 1, two = 2, three = 3;
- base::mac::ScopedCFTypeRef<CFNumberRef> cf_one(
+ ScopedCFTypeRef<CFNumberRef> cf_one(
CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));
- base::mac::ScopedCFTypeRef<CFNumberRef> cf_two(
+ ScopedCFTypeRef<CFNumberRef> cf_two(
CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &two));
- base::mac::ScopedCFTypeRef<CFNumberRef> cf_three(
+ ScopedCFTypeRef<CFNumberRef> cf_three(
CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &three));
CFStringRef keys[] = { CFSTR("one"), CFSTR("two"), CFSTR("three") };
@@ -295,7 +281,7 @@ TEST(FoundationUtilTest, GetValueFromDictionary) {
COMPILE_ASSERT(arraysize(keys) == arraysize(values),
keys_and_values_arraysizes_are_different);
- base::mac::ScopedCFTypeRef<CFDictionaryRef> test_dict(
+ ScopedCFTypeRef<CFDictionaryRef> test_dict(
CFDictionaryCreate(kCFAllocatorDefault,
reinterpret_cast<const void**>(keys),
reinterpret_cast<const void**>(values),
@@ -303,33 +289,31 @@ TEST(FoundationUtilTest, GetValueFromDictionary) {
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
- // base::mac::GetValueFromDictionary<>(_, _) should produce the correct
+ // GetValueFromDictionary<>(_, _) should produce the correct
// expected output.
EXPECT_EQ(values[0],
- base::mac::GetValueFromDictionary<CFNumberRef>(test_dict,
- CFSTR("one")));
+ GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("one")));
EXPECT_EQ(values[1],
- base::mac::GetValueFromDictionary<CFNumberRef>(test_dict,
- CFSTR("two")));
+ GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("two")));
EXPECT_EQ(values[2],
- base::mac::GetValueFromDictionary<CFNumberRef>(test_dict,
- CFSTR("three")));
+ GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("three")));
// Bad input should produce bad output.
- EXPECT_FALSE(base::mac::GetValueFromDictionary<CFNumberRef>(test_dict,
- CFSTR("four")));
- EXPECT_FALSE(base::mac::GetValueFromDictionary<CFStringRef>(test_dict,
- CFSTR("one")));
+ EXPECT_FALSE(GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("four")));
+ EXPECT_FALSE(GetValueFromDictionary<CFStringRef>(test_dict, CFSTR("one")));
}
TEST(FoundationUtilTest, FilePathToNSString) {
- EXPECT_NSEQ(nil, base::mac::FilePathToNSString(FilePath()));
- EXPECT_NSEQ(@"/a/b", base::mac::FilePathToNSString(FilePath("/a/b")));
+ EXPECT_NSEQ(nil, FilePathToNSString(FilePath()));
+ EXPECT_NSEQ(@"/a/b", FilePathToNSString(FilePath("/a/b")));
}
// http://crbug.com/173983 Fails consistently under Mac ASAN.
TEST(FoundationUtilTest, DISABLED_NSStringToFilePath) {
- EXPECT_EQ(FilePath(), base::mac::NSStringToFilePath(nil));
- EXPECT_EQ(FilePath(), base::mac::NSStringToFilePath(@""));
- EXPECT_EQ(FilePath("/a/b"), base::mac::NSStringToFilePath(@"/a/b"));
+ EXPECT_EQ(FilePath(), NSStringToFilePath(nil));
+ EXPECT_EQ(FilePath(), NSStringToFilePath(@""));
+ EXPECT_EQ(FilePath("/a/b"), NSStringToFilePath(@"/a/b"));
}
+
+} // namespace mac
+} // namespace base
diff --git a/base/win/event_trace_consumer_unittest.cc b/base/win/event_trace_consumer_unittest.cc
index 7af9452..9e9297c 100644
--- a/base/win/event_trace_consumer_unittest.cc
+++ b/base/win/event_trace_consumer_unittest.cc
@@ -23,13 +23,10 @@
#include <initguid.h> // NOLINT - has to be last
-namespace {
+namespace base {
+namespace win {
-using base::win::EtwMofEvent;
-using base::win::EtwTraceController;
-using base::win::EtwTraceConsumerBase;
-using base::win::EtwTraceProperties;
-using base::win::EtwTraceProvider;
+namespace {
typedef std::list<EVENT_TRACE> EventQueue;
@@ -70,21 +67,21 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
::SetEvent(sank_event_.Get());
}
- static base::win::ScopedHandle sank_event_;
+ static ScopedHandle sank_event_;
static EventQueue events_;
private:
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
};
-base::win::ScopedHandle TestConsumer::sank_event_;
+ScopedHandle TestConsumer::sank_event_;
EventQueue TestConsumer::events_;
class EtwTraceConsumerBaseTest: public testing::Test {
public:
EtwTraceConsumerBaseTest()
- : session_name_(base::StringPrintf(L"TestSession-%d",
- base::Process::Current().pid())) {
+ : session_name_(StringPrintf(L"TestSession-%d",
+ Process::Current().pid())) {
}
virtual void SetUp() {
@@ -206,8 +203,8 @@ class EtwTraceConsumerRealtimeTest: public EtwTraceConsumerBaseTest {
}
TestConsumer consumer_;
- base::win::ScopedHandle consumer_ready_;
- base::win::ScopedHandle consumer_thread_;
+ ScopedHandle consumer_ready_;
+ ScopedHandle consumer_thread_;
};
} // namespace
@@ -356,7 +353,7 @@ class EtwTraceConsumerDataTest: public EtwTraceConsumerBaseTest {
}
EventQueue events_;
- base::ScopedTempDir temp_dir_;
+ ScopedTempDir temp_dir_;
FilePath temp_file_;
};
@@ -381,3 +378,6 @@ TEST_F(EtwTraceConsumerDataTest, RoundTrip) {
ASSERT_EQ(sizeof(kData), trace->MofLength);
ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData));
}
+
+} // namespace win
+} // namespace base
diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc
index fae606e..82c4106 100644
--- a/base/win/event_trace_controller_unittest.cc
+++ b/base/win/event_trace_controller_unittest.cc
@@ -19,11 +19,10 @@
#include "base/win/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
+namespace base {
+namespace win {
-using base::win::EtwTraceController;
-using base::win::EtwTraceProvider;
-using base::win::EtwTraceProperties;
+namespace {
DEFINE_GUID(kGuidNull,
0x0000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0);
@@ -50,7 +49,7 @@ class TestingProvider: public EtwTraceProvider {
::SetEvent(callback_event_.Get());
}
- base::win::ScopedHandle callback_event_;
+ ScopedHandle callback_event_;
DISALLOW_COPY_AND_ASSIGN(TestingProvider);
};
@@ -110,8 +109,9 @@ namespace {
class EtwTraceControllerTest : public testing::Test {
public:
- EtwTraceControllerTest() : session_name_(
- base::StringPrintf(L"TestSession-%d", base::Process::Current().pid())) {
+ EtwTraceControllerTest()
+ : session_name_(
+ StringPrintf(L"TestSession-%d", Process::Current().pid())) {
}
virtual void SetUp() {
@@ -161,7 +161,7 @@ TEST_F(EtwTraceControllerTest, StartRealTimeSession) {
}
TEST_F(EtwTraceControllerTest, StartFileSession) {
- base::ScopedTempDir temp_dir;
+ ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
FilePath temp;
ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp));
@@ -234,3 +234,6 @@ TEST_F(EtwTraceControllerTest, EnableDisable) {
EXPECT_EQ(0, provider.enable_level());
EXPECT_EQ(0, provider.enable_flags());
}
+
+} // namespace win
+} // namespace base
diff --git a/base/win/shortcut_unittest.cc b/base/win/shortcut_unittest.cc
index 70cc852..14aab29 100644
--- a/base/win/shortcut_unittest.cc
+++ b/base/win/shortcut_unittest.cc
@@ -14,6 +14,9 @@
#include "base/win/scoped_com_initializer.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+namespace win {
+
namespace {
static const char kFileContents[] = "This is a target.";
@@ -61,31 +64,31 @@ class ShortcutTest : public testing::Test {
}
}
- base::win::ScopedCOMInitializer com_initializer_;
- base::ScopedTempDir temp_dir_;
- base::ScopedTempDir temp_dir_2_;
+ ScopedCOMInitializer com_initializer_;
+ ScopedTempDir temp_dir_;
+ ScopedTempDir temp_dir_2_;
// The link file to be created/updated in the shortcut tests below.
FilePath link_file_;
// Properties for the created shortcut.
- base::win::ShortcutProperties link_properties_;
+ ShortcutProperties link_properties_;
// Properties for the updated shortcut.
- base::win::ShortcutProperties link_properties_2_;
+ ShortcutProperties link_properties_2_;
};
} // namespace
TEST_F(ShortcutTest, CreateAndResolveShortcut) {
- base::win::ShortcutProperties only_target_properties;
+ ShortcutProperties only_target_properties;
only_target_properties.set_target(link_properties_.target);
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, only_target_properties, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, only_target_properties, SHORTCUT_CREATE_ALWAYS));
FilePath resolved_name;
- EXPECT_TRUE(base::win::ResolveShortcut(link_file_, &resolved_name, NULL));
+ EXPECT_TRUE(ResolveShortcut(link_file_, &resolved_name, NULL));
char read_contents[arraysize(kFileContents)];
file_util::ReadFile(resolved_name, read_contents, arraysize(read_contents));
@@ -93,12 +96,12 @@ TEST_F(ShortcutTest, CreateAndResolveShortcut) {
}
TEST_F(ShortcutTest, ResolveShortcutWithArgs) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
FilePath resolved_name;
string16 args;
- EXPECT_TRUE(base::win::ResolveShortcut(link_file_, &resolved_name, &args));
+ EXPECT_TRUE(ResolveShortcut(link_file_, &resolved_name, &args));
char read_contents[arraysize(kFileContents)];
file_util::ReadFile(resolved_name, read_contents, arraysize(read_contents));
@@ -107,51 +110,51 @@ TEST_F(ShortcutTest, ResolveShortcutWithArgs) {
}
TEST_F(ShortcutTest, CreateShortcutWithOnlySomeProperties) {
- base::win::ShortcutProperties target_and_args_properties;
+ ShortcutProperties target_and_args_properties;
target_and_args_properties.set_target(link_properties_.target);
target_and_args_properties.set_arguments(link_properties_.arguments);
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
link_file_, target_and_args_properties,
- base::win::SHORTCUT_CREATE_ALWAYS));
+ SHORTCUT_CREATE_ALWAYS));
- base::win::ValidateShortcut(link_file_, target_and_args_properties);
+ ValidateShortcut(link_file_, target_and_args_properties);
}
TEST_F(ShortcutTest, CreateShortcutVerifyProperties) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- base::win::ValidateShortcut(link_file_, link_properties_);
+ ValidateShortcut(link_file_, link_properties_);
}
TEST_F(ShortcutTest, UpdateShortcutVerifyProperties) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_2_, base::win::SHORTCUT_UPDATE_EXISTING));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_2_, SHORTCUT_UPDATE_EXISTING));
- base::win::ValidateShortcut(link_file_, link_properties_2_);
+ ValidateShortcut(link_file_, link_properties_2_);
}
TEST_F(ShortcutTest, UpdateShortcutUpdateOnlyTargetAndResolve) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- base::win::ShortcutProperties update_only_target_properties;
+ ShortcutProperties update_only_target_properties;
update_only_target_properties.set_target(link_properties_2_.target);
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
link_file_, update_only_target_properties,
- base::win::SHORTCUT_UPDATE_EXISTING));
+ SHORTCUT_UPDATE_EXISTING));
- base::win::ShortcutProperties expected_properties = link_properties_;
+ ShortcutProperties expected_properties = link_properties_;
expected_properties.set_target(link_properties_2_.target);
- base::win::ValidateShortcut(link_file_, expected_properties);
+ ValidateShortcut(link_file_, expected_properties);
FilePath resolved_name;
- EXPECT_TRUE(base::win::ResolveShortcut(link_file_, &resolved_name, NULL));
+ EXPECT_TRUE(ResolveShortcut(link_file_, &resolved_name, NULL));
char read_contents[arraysize(kFileContents2)];
file_util::ReadFile(resolved_name, read_contents, arraysize(read_contents));
@@ -159,109 +162,112 @@ TEST_F(ShortcutTest, UpdateShortcutUpdateOnlyTargetAndResolve) {
}
TEST_F(ShortcutTest, UpdateShortcutMakeDualMode) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- base::win::ShortcutProperties make_dual_mode_properties;
+ ShortcutProperties make_dual_mode_properties;
make_dual_mode_properties.set_dual_mode(true);
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
link_file_, make_dual_mode_properties,
- base::win::SHORTCUT_UPDATE_EXISTING));
+ SHORTCUT_UPDATE_EXISTING));
- base::win::ShortcutProperties expected_properties = link_properties_;
+ ShortcutProperties expected_properties = link_properties_;
expected_properties.set_dual_mode(true);
- base::win::ValidateShortcut(link_file_, expected_properties);
+ ValidateShortcut(link_file_, expected_properties);
}
TEST_F(ShortcutTest, UpdateShortcutRemoveDualMode) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_2_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_2_, SHORTCUT_CREATE_ALWAYS));
- base::win::ShortcutProperties remove_dual_mode_properties;
+ ShortcutProperties remove_dual_mode_properties;
remove_dual_mode_properties.set_dual_mode(false);
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
link_file_, remove_dual_mode_properties,
- base::win::SHORTCUT_UPDATE_EXISTING));
+ SHORTCUT_UPDATE_EXISTING));
- base::win::ShortcutProperties expected_properties = link_properties_2_;
+ ShortcutProperties expected_properties = link_properties_2_;
expected_properties.set_dual_mode(false);
- base::win::ValidateShortcut(link_file_, expected_properties);
+ ValidateShortcut(link_file_, expected_properties);
}
TEST_F(ShortcutTest, UpdateShortcutClearArguments) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- base::win::ShortcutProperties clear_arguments_properties;
+ ShortcutProperties clear_arguments_properties;
clear_arguments_properties.set_arguments(string16());
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
link_file_, clear_arguments_properties,
- base::win::SHORTCUT_UPDATE_EXISTING));
+ SHORTCUT_UPDATE_EXISTING));
- base::win::ShortcutProperties expected_properties = link_properties_;
+ ShortcutProperties expected_properties = link_properties_;
expected_properties.set_arguments(string16());
- base::win::ValidateShortcut(link_file_, expected_properties);
+ ValidateShortcut(link_file_, expected_properties);
}
TEST_F(ShortcutTest, FailUpdateShortcutThatDoesNotExist) {
- ASSERT_FALSE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_UPDATE_EXISTING));
+ ASSERT_FALSE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_UPDATE_EXISTING));
ASSERT_FALSE(file_util::PathExists(link_file_));
}
TEST_F(ShortcutTest, ReplaceShortcutAllProperties) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_2_, base::win::SHORTCUT_REPLACE_EXISTING));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING));
- base::win::ValidateShortcut(link_file_, link_properties_2_);
+ ValidateShortcut(link_file_, link_properties_2_);
}
TEST_F(ShortcutTest, ReplaceShortcutSomeProperties) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
- base::win::ShortcutProperties new_properties;
+ ShortcutProperties new_properties;
new_properties.set_target(link_properties_2_.target);
new_properties.set_arguments(link_properties_2_.arguments);
new_properties.set_description(link_properties_2_.description);
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, new_properties, base::win::SHORTCUT_REPLACE_EXISTING));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, new_properties, SHORTCUT_REPLACE_EXISTING));
// Expect only properties in |new_properties| to be set, all other properties
// should have been overwritten.
- base::win::ShortcutProperties expected_properties(new_properties);
+ ShortcutProperties expected_properties(new_properties);
expected_properties.set_working_dir(FilePath());
expected_properties.set_icon(FilePath(), 0);
expected_properties.set_app_id(string16());
expected_properties.set_dual_mode(false);
- base::win::ValidateShortcut(link_file_, expected_properties);
+ ValidateShortcut(link_file_, expected_properties);
}
TEST_F(ShortcutTest, FailReplaceShortcutThatDoesNotExist) {
- ASSERT_FALSE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_REPLACE_EXISTING));
+ ASSERT_FALSE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_REPLACE_EXISTING));
ASSERT_FALSE(file_util::PathExists(link_file_));
}
// Test that the old arguments remain on the replaced shortcut when not
// otherwise specified.
TEST_F(ShortcutTest, ReplaceShortcutKeepOldArguments) {
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
// Do not explicitly set the arguments.
link_properties_2_.options &=
- ~base::win::ShortcutProperties::PROPERTIES_ARGUMENTS;
- ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
- link_file_, link_properties_2_, base::win::SHORTCUT_REPLACE_EXISTING));
+ ~ShortcutProperties::PROPERTIES_ARGUMENTS;
+ ASSERT_TRUE(CreateOrUpdateShortcutLink(
+ link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING));
- base::win::ShortcutProperties expected_properties(link_properties_2_);
+ ShortcutProperties expected_properties(link_properties_2_);
expected_properties.set_arguments(link_properties_.arguments);
- base::win::ValidateShortcut(link_file_, expected_properties);
+ ValidateShortcut(link_file_, expected_properties);
}
+
+} // namespace win
+} // namespace base