Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: chrome/test/base/chrome_test_suite.cc

Issue 10914279: Cleanup: Add a const variable for /proc/self/exe. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/process_util_linux.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/base/chrome_test_suite.h" 5 #include "chrome/test/base/chrome_test_suite.h"
6 6
7 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 #endif 10 #endif
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // on disk. 54 // on disk.
55 #if defined(OS_POSIX) 55 #if defined(OS_POSIX)
56 base::SharedMemory memory; 56 base::SharedMemory memory;
57 memory.Delete(filename); 57 memory.Delete(filename);
58 #endif 58 #endif
59 } 59 }
60 60
61 bool IsCrosPythonProcess() { 61 bool IsCrosPythonProcess() {
62 #if defined(OS_CHROMEOS) 62 #if defined(OS_CHROMEOS)
63 char buf[80]; 63 char buf[80];
64 int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1); 64 int num_read = readlink(base::kProcSelfExe, buf, sizeof(buf) - 1);
65 if (num_read == -1) 65 if (num_read == -1)
66 return false; 66 return false;
67 buf[num_read] = 0; 67 buf[num_read] = 0;
68 const char kPythonPrefix[] = "/python"; 68 const char kPythonPrefix[] = "/python";
69 return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1); 69 return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1);
70 #else
71 return false;
70 #endif // defined(OS_CHROMEOS) 72 #endif // defined(OS_CHROMEOS)
71 return false;
72 } 73 }
73 74
74 // In many cases it may be not obvious that a test makes a real DNS lookup. 75 // In many cases it may be not obvious that a test makes a real DNS lookup.
75 // We generally don't want to rely on external DNS servers for our tests, 76 // We generally don't want to rely on external DNS servers for our tests,
76 // so this host resolver procedure catches external queries and returns a failed 77 // so this host resolver procedure catches external queries and returns a failed
77 // lookup result. 78 // lookup result.
78 class LocalHostResolverProc : public net::HostResolverProc { 79 class LocalHostResolverProc : public net::HostResolverProc {
79 public: 80 public:
80 LocalHostResolverProc() : HostResolverProc(NULL) {} 81 LocalHostResolverProc() : HostResolverProc(NULL) {}
81 82
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 #if defined(OS_MACOSX) 247 #if defined(OS_MACOSX)
247 base::mac::SetOverrideFrameworkBundle(NULL); 248 base::mac::SetOverrideFrameworkBundle(NULL);
248 #endif 249 #endif
249 250
250 base::StatsTable::set_current(NULL); 251 base::StatsTable::set_current(NULL);
251 stats_table_.reset(); 252 stats_table_.reset();
252 RemoveSharedMemoryFile(stats_filename_); 253 RemoveSharedMemoryFile(stats_filename_);
253 254
254 base::TestSuite::Shutdown(); 255 base::TestSuite::Shutdown();
255 } 256 }
OLDNEW
« no previous file with comments | « base/process_util_linux.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698