OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |