| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // We want to have a current history database when we start the browser so | 75 // We want to have a current history database when we start the browser so |
| 76 // things like the NTP will have thumbnails. This method updates the dates | 76 // things like the NTP will have thumbnails. This method updates the dates |
| 77 // in the history to be more recent. | 77 // in the history to be more recent. |
| 78 void UpdateHistoryDates(const base::FilePath& user_data_dir) { | 78 void UpdateHistoryDates(const base::FilePath& user_data_dir) { |
| 79 // Migrate the times in the segment_usage table to yesterday so we get | 79 // Migrate the times in the segment_usage table to yesterday so we get |
| 80 // actual thumbnails on the NTP. | 80 // actual thumbnails on the NTP. |
| 81 sql::Connection db; | 81 sql::Connection db; |
| 82 base::FilePath history = | 82 base::FilePath history = |
| 83 user_data_dir.AppendASCII("Default").AppendASCII("History"); | 83 user_data_dir.AppendASCII("Default").AppendASCII("History"); |
| 84 // Not all test profiles have a history file. | 84 // Not all test profiles have a history file. |
| 85 if (!file_util::PathExists(history)) | 85 if (!base::PathExists(history)) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 ASSERT_TRUE(db.Open(history)); | 88 ASSERT_TRUE(db.Open(history)); |
| 89 base::Time yesterday = base::Time::Now() - base::TimeDelta::FromDays(1); | 89 base::Time yesterday = base::Time::Now() - base::TimeDelta::FromDays(1); |
| 90 std::string yesterday_str = base::Int64ToString(yesterday.ToInternalValue()); | 90 std::string yesterday_str = base::Int64ToString(yesterday.ToInternalValue()); |
| 91 std::string query = base::StringPrintf( | 91 std::string query = base::StringPrintf( |
| 92 "UPDATE segment_usage " | 92 "UPDATE segment_usage " |
| 93 "SET time_slot = %s " | 93 "SET time_slot = %s " |
| 94 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);", | 94 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);", |
| 95 yesterday_str.c_str()); | 95 yesterday_str.c_str()); |
| (...skipping 532 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 |