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/automation/proxy_launcher.h" | 5 #include "chrome/test/automation/proxy_launcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // This also kicks the files out of the memory cache for the startup tests. | 48 // This also kicks the files out of the memory cache for the startup tests. |
49 // TODO(brettw) bug 237904: This is the wrong place for this code. It means all | 49 // TODO(brettw) bug 237904: This is the wrong place for this code. It means all |
50 // startup tests other than the "cold" ones run more slowly than necessary. | 50 // startup tests other than the "cold" ones run more slowly than necessary. |
51 bool CopyDirectoryContentsNoCache(const base::FilePath& source, | 51 bool CopyDirectoryContentsNoCache(const base::FilePath& source, |
52 const base::FilePath& dest) { | 52 const base::FilePath& dest) { |
53 base::FileEnumerator en(source, false, | 53 base::FileEnumerator en(source, false, |
54 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); | 54 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); |
55 for (base::FilePath cur = en.Next(); !cur.empty(); cur = en.Next()) { | 55 for (base::FilePath cur = en.Next(); !cur.empty(); cur = en.Next()) { |
56 base::FileEnumerator::FileInfo info = en.GetInfo(); | 56 base::FileEnumerator::FileInfo info = en.GetInfo(); |
57 if (info.IsDirectory()) { | 57 if (info.IsDirectory()) { |
58 if (!file_util::CopyDirectory(cur, dest, true)) | 58 if (!base::CopyDirectory(cur, dest, true)) |
59 return false; | 59 return false; |
60 } else { | 60 } else { |
61 if (!file_util::CopyFile(cur, dest.Append(cur.BaseName()))) | 61 if (!base::CopyFile(cur, dest.Append(cur.BaseName()))) |
62 return false; | 62 return false; |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 // Kick out the profile files, this must happen after SetUp which creates the | 66 // Kick out the profile files, this must happen after SetUp which creates the |
67 // profile. It might be nicer to use EvictFileFromSystemCacheWrapper from | 67 // profile. It might be nicer to use EvictFileFromSystemCacheWrapper from |
68 // UITest which will retry on failure. | 68 // UITest which will retry on failure. |
69 base::FileEnumerator kickout(dest, true, base::FileEnumerator::FILES); | 69 base::FileEnumerator kickout(dest, true, base::FileEnumerator::FILES); |
70 for (base::FilePath cur = kickout.Next(); !cur.empty(); cur = kickout.Next()) | 70 for (base::FilePath cur = kickout.Next(); !cur.empty(); cur = kickout.Next()) |
71 base::EvictFileFromSystemCacheWithRetry(cur); | 71 base::EvictFileFromSystemCacheWithRetry(cur); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 return LaunchBrowserAndServer(state, wait_for_initial_loads); | 628 return LaunchBrowserAndServer(state, wait_for_initial_loads); |
629 } | 629 } |
630 | 630 |
631 void AnonymousProxyLauncher::TerminateConnection() { | 631 void AnonymousProxyLauncher::TerminateConnection() { |
632 CloseBrowserAndServer(); | 632 CloseBrowserAndServer(); |
633 } | 633 } |
634 | 634 |
635 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 635 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
636 return channel_id_; | 636 return channel_id_; |
637 } | 637 } |
OLD | NEW |