diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 20:26:29 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 20:26:29 +0000 |
commit | f66c110c118bf7e5c386d49a5f4e83d948441b45 (patch) | |
tree | d052b77548d3c11450a7b886809aaf11c8f46a55 | |
parent | d8b258c5e97adbc8e73dd73b319d1cdacb4c15d7 (diff) | |
download | chromium_src-f66c110c118bf7e5c386d49a5f4e83d948441b45.zip chromium_src-f66c110c118bf7e5c386d49a5f4e83d948441b45.tar.gz chromium_src-f66c110c118bf7e5c386d49a5f4e83d948441b45.tar.bz2 |
fix chrome_paths to make some test dirs relative to base::DIR_SOURCE_ROOT
rather than chrome::DIR_APP. DIR_APP is in different relative locations on
different platforms while DIR_SOURCE_ROOT is the same, so this allows us to
share code and be correct on all platforms.
Also, enable extensions_service_unittest for Mac and Linux and add an
NSAutoreleasePool to ChromeTestSuite (which is now being used by
run_all_unittests on Mac and Linux per my earlier checkin).
Review URL: http://codereview.chromium.org/13177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6445 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 24 | ||||
-rw-r--r-- | chrome/common/chrome_paths.cc | 16 | ||||
-rw-r--r-- | chrome/test/unit/chrome_test_suite.h | 3 |
4 files changed, 30 insertions, 21 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 22e891d..da86f27 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -13,9 +13,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/json_value_serializer.h" #include "testing/gtest/include/gtest/gtest.h" - -class ExtensionsServiceTest : public testing::Test { -}; +#include "testing/platform_test.h" // A mock implementation of ExtensionsServiceFrontendInterface for testing the @@ -50,10 +48,11 @@ class ExtensionsServiceTestFrontend std::vector<std::wstring> errors_; }; +// make the test a PlatformTest to setup autorelease pools properly on mac +typedef PlatformTest ExtensionsServiceTest; // Test loading extensions from the profile directory. TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectory) { -#if defined(OS_WIN) std::wstring extensions_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_dir)); FilePath manifest_path = FilePath::FromWStringHack(extensions_dir).Append( @@ -94,5 +93,4 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectory) { EXPECT_EQ(std::wstring(L""), frontend->extensions()->at(1)->description()); EXPECT_EQ(0u, frontend->extensions()->at(1)->content_scripts().size()); -#endif }; diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index f421096..0467e3e 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -150,6 +150,8 @@ 4DDC63E70EAE344300FB5EBE /* metrics_response_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8B60E9D4839009A6919 /* metrics_response_unittest.cc */; }; 4DDC644B0EAE390800FB5EBE /* libxml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFB230E9D4BBF009A6919 /* libxml.a */; }; 4DDC64580EAE394200FB5EBE /* libzlib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DDC64550EAE392400FB5EBE /* libzlib.a */; }; + A54612DC0EE9958600A8EE5D /* extensions_service_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A54612DB0EE9958600A8EE5D /* extensions_service_unittest.cc */; }; + A54612E20EE995F600A8EE5D /* extensions_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = A54612D90EE9957000A8EE5D /* extensions_service.cc */; }; B54BD8FC0ED622C00093FD54 /* mach_message_source_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = B54BD8FA0ED622C00093FD54 /* mach_message_source_mac.cc */; }; B562C8430ED49C830077A23F /* mach_ipc_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B562C8420ED49C830077A23F /* mach_ipc_mac.mm */; }; B5FDC0580EE488E500BEC6E6 /* ipc_channel_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5FDC0570EE488E500BEC6E6 /* ipc_channel_posix.cc */; }; @@ -610,49 +612,49 @@ isa = PBXContainerItemProxy; containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */; proxyType = 1; - remoteGlobalIDString = E45060E30EE87B86003BE099 /* app */; + remoteGlobalIDString = E45060E30EE87B86003BE099; remoteInfo = app; }; E45062660EE890B3003BE099 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BFDBE0E9D525B009A6919 /* base.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 825402BA0D92D0FA0006B936 /* base */; + remoteGlobalIDString = 825402BA0D92D0FA0006B936; remoteInfo = base; }; E450629B0EE8912D003BE099 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 82C262C30DCF9411005CFE91 /* icudata */; + remoteGlobalIDString = 82C262C30DCF9411005CFE91; remoteInfo = icudata; }; E450629D0EE8912D003BE099 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 7BD5408A0D6F743F003CD41E /* icudata_stub */; + remoteGlobalIDString = 7BD5408A0D6F743F003CD41E; remoteInfo = icudata_stub; }; E450629F0EE8912D003BE099 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 7BD53EA50D6F6FC7003CD41E /* icui18n */; + remoteGlobalIDString = 7BD53EA50D6F6FC7003CD41E; remoteInfo = icui18n; }; E45062A10EE8912D003BE099 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 7BD540250D6F727B003CD41E /* icutu */; + remoteGlobalIDString = 7BD540250D6F727B003CD41E; remoteInfo = icutu; }; E45062A30EE8912D003BE099 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 7BD53AAA0D6F6671003CD41E /* icuuc */; + remoteGlobalIDString = 7BD53AAA0D6F6671003CD41E; remoteInfo = icuuc; }; E4F3259A0EE837DD002533CE /* PBXContainerItemProxy */ = { @@ -1382,6 +1384,9 @@ 4D7BFF5F0E9D540F009A6919 /* googleurl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = googleurl.xcodeproj; path = build/googleurl.xcodeproj; sourceTree = "<group>"; }; 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = "<group>"; }; 4DDC64500EAE392400FB5EBE /* zlib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = zlib.xcodeproj; path = third_party/zlib/zlib.xcodeproj; sourceTree = "<group>"; }; + A54612D90EE9957000A8EE5D /* extensions_service.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extensions_service.cc; sourceTree = "<group>"; }; + A54612DA0EE9957000A8EE5D /* extensions_service.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extensions_service.h; sourceTree = "<group>"; }; + A54612DB0EE9958600A8EE5D /* extensions_service_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extensions_service_unittest.cc; sourceTree = "<group>"; }; B54BD8FA0ED622C00093FD54 /* mach_message_source_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mach_message_source_mac.cc; sourceTree = "<group>"; }; B54BD8FB0ED622C00093FD54 /* mach_message_source_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_message_source_mac.h; sourceTree = "<group>"; }; B562C8410ED49C830077A23F /* mach_ipc_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_ipc_mac.h; sourceTree = "<group>"; }; @@ -2567,6 +2572,9 @@ E4F324400EE5CE94002533CE /* extension.cc */, E4F324410EE5CE94002533CE /* extension.h */, E4F324420EE5CE94002533CE /* extension_unittest.cc */, + A54612D90EE9957000A8EE5D /* extensions_service.cc */, + A54612DA0EE9957000A8EE5D /* extensions_service.h */, + A54612DB0EE9958600A8EE5D /* extensions_service_unittest.cc */, ); path = extensions; sourceTree = "<group>"; @@ -3058,6 +3066,7 @@ E4F324550EE5CFB1002533CE /* download_database.cc in Sources */, E4F324470EE5CF1F002533CE /* expire_history_backend.cc in Sources */, E4F324430EE5CE94002533CE /* extension.cc in Sources */, + A54612E20EE995F600A8EE5D /* extensions_service.cc in Sources */, 4D7BF9990E9D486B009A6919 /* google_url_tracker.cc in Sources */, 4D7BF99E0E9D486F009A6919 /* google_util.cc in Sources */, E4F3244A0EE5CF3C002533CE /* history_backend.cc in Sources */, @@ -3129,6 +3138,7 @@ 4D7BFB3E0E9D4C2F009A6919 /* text_database_unittest.cc in Sources */, 4D7BFB610E9D4C4B009A6919 /* units_unittest.cc in Sources */, 4D7BFB420E9D4C35009A6919 /* visit_tracker_unittest.cc in Sources */, + A54612DC0EE9958600A8EE5D /* extensions_service_unittest.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 1ffaaf4..edb0d58 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -213,28 +213,26 @@ bool PathProvider(int key, FilePath* result) { // will fail if executed from an installed executable (because the // generated path won't exist). case chrome::DIR_TEST_DATA: - if (!PathService::Get(chrome::DIR_APP, &cur)) + if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) return false; - file_util::UpOneDirectory(&cur); + file_util::AppendToPath(&cur, L"chrome"); file_util::AppendToPath(&cur, L"test"); file_util::AppendToPath(&cur, L"data"); if (!file_util::PathExists(cur)) // we don't want to create this return false; break; case chrome::DIR_TEST_TOOLS: - if (!PathService::Get(chrome::DIR_APP, &cur)) + if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) return false; - file_util::UpOneDirectory(&cur); + file_util::AppendToPath(&cur, L"chrome"); file_util::AppendToPath(&cur, L"tools"); file_util::AppendToPath(&cur, L"test"); if (!file_util::PathExists(cur)) // we don't want to create this return false; break; case chrome::FILE_PYTHON_RUNTIME: - if (!PathService::Get(chrome::DIR_APP, &cur)) + if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) return false; - file_util::UpOneDirectory(&cur); // chrome - file_util::UpOneDirectory(&cur); file_util::AppendToPath(&cur, L"third_party"); file_util::AppendToPath(&cur, L"python_24"); file_util::AppendToPath(&cur, L"python.exe"); @@ -242,9 +240,9 @@ bool PathProvider(int key, FilePath* result) { return false; break; case chrome::FILE_TEST_SERVER: - if (!PathService::Get(chrome::DIR_APP, &cur)) + if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) return false; - file_util::UpOneDirectory(&cur); + file_util::AppendToPath(&cur, L"net"); file_util::AppendToPath(&cur, L"tools"); file_util::AppendToPath(&cur, L"test"); file_util::AppendToPath(&cur, L"testserver"); diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index b2c192a..3ea6059 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -8,6 +8,7 @@ #include "base/stats_table.h" #include "base/file_util.h" #include "base/path_service.h" +#include "base/scoped_nsautorelease_pool.h" #include "base/test_suite.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -24,6 +25,8 @@ public: protected: virtual void Initialize() { + base::ScopedNSAutoreleasePool autorelease_pool; + TestSuite::Initialize(); chrome::RegisterPathProvider(); |