Bug 1315830 - Remove unused nsIFileEnumerator program. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Wed, 09 Nov 2016 10:33:17 -0800
changeset 351983 d6a0b28b04e4b35494d15155f79e43cdc5244835
parent 351982 54098e53a5841ce10c1f3fc2bb507b77587e7d7c
child 351984 f05a94693082bc06aadaabdf87940ddad52de605
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1315830
milestone52.0a1
Bug 1315830 - Remove unused nsIFileEnumerator program. r=froydnj This seems to have been added back in 2000 as some sort of ad-hoc nsIFile test. There is now an actual gtest for nsIFile so this should be safe to remove. MozReview-Commit-ID: DMeVmBNmf8f
xpcom/tests/moz.build
xpcom/tests/nsIFileEnumerator.cpp
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -22,17 +22,16 @@ EXPORTS.testing += [
 SimplePrograms([
     'TestArguments',
     'TestBlockingProcess',
     'TestPRIntN',
     'TestQuickReturn',
 ])
 
 GeckoSimplePrograms([
-    'nsIFileEnumerator',
     'TestCallTemplates',
     'TestINIParser',
     'TestRacingServiceManager',
     'TestRegistrationOrder',
     'TestThreadPoolListener',
     'TestUnicodeArguments',
 ])
 
deleted file mode 100644
--- a/xpcom/tests/nsIFileEnumerator.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#include "nsIFile.h"
-#include "nsStringGlue.h"
-
-#include <stdio.h>
-#include "nsIComponentRegistrar.h"
-#include "nsIComponentManager.h"
-#include "nsIServiceManager.h"
-#include "nsMemory.h"
-#include "nsISimpleEnumerator.h"
-#include "nsCOMPtr.h"
-
-static bool LoopInDir(nsIFile* aFile)
-{
-    nsresult rv;
-    nsCOMPtr<nsISimpleEnumerator> entries;
-    rv = aFile->GetDirectoryEntries(getter_AddRefs(entries));
-    if(NS_FAILED(rv) || !entries)
-        return false;
-    
-    bool hasMore;
-    while(NS_SUCCEEDED(entries->HasMoreElements(&hasMore)) && hasMore)
-    {
-        nsCOMPtr<nsISupports> sup;
-        entries->GetNext(getter_AddRefs(sup));
-        if(!sup)
-            return false;
-
-        nsCOMPtr<nsIFile> nextFile = do_QueryInterface(sup);
-        if (!nextFile)
-            return false;
-    
-        nsAutoCString name;
-        if(NS_FAILED(nextFile->GetNativeLeafName(name)))
-            return false;
-        
-        bool isDir;
-        printf("%s\n", name.get());
-        rv = nextFile->IsDirectory(&isDir);
-        if (NS_FAILED(rv))
-		{
-			printf("IsDirectory Failed!!!\n");
-				return false;
-		}
-
-		if (isDir)
-        {
-           LoopInDir(nextFile);
-        }
-    }
-    return true;
-}
-
-
-int
-main(int argc, char* argv[])
-{
-    nsresult rv;
-    {
-        nsCOMPtr<nsIFile> topDir;
-
-        nsCOMPtr<nsIServiceManager> servMan;
-        rv = NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
-        if (NS_FAILED(rv)) return -1;
-
-        if (argc > 1 && argv[1] != nullptr)
-        {
-            char* pathStr = argv[1];
-            NS_NewNativeLocalFile(nsDependentCString(pathStr), false, getter_AddRefs(topDir));
-        }
-    
-        if (!topDir)
-        {
-           printf("No Top Dir\n");
-           return -1;
-        }
-        int32_t startTime = PR_IntervalNow();
-    
-        LoopInDir(topDir);
-    
-        int32_t endTime = PR_IntervalNow();
-    
-        printf("\nTime: %d\n", PR_IntervalToMilliseconds(endTime - startTime));
-    } // this scopes the nsCOMPtrs
-    // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
-    rv = NS_ShutdownXPCOM(nullptr);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
-    return 0;
-}