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

Side by Side Diff: chrome/test/ui/ui_test.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « chrome/test/ui/ui_layout_test.cc ('k') | chrome_frame/metrics_service.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #endif 10 #endif
11 11
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "app/sql/connection.h" 15 #include "app/sql/connection.h"
16 #include "base/base_switches.h" 16 #include "base/base_switches.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/file_path.h" 18 #include "base/file_path.h"
19 #include "base/file_util.h" 19 #include "base/file_util.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/platform_thread.h" 21 #include "base/platform_thread.h"
22 #include "base/process_util.h" 22 #include "base/process_util.h"
23 #include "base/scoped_ptr.h" 23 #include "base/scoped_ptr.h"
24 #include "base/scoped_temp_dir.h" 24 #include "base/scoped_temp_dir.h"
25 #include "base/string_util.h" 25 #include "base/string_number_conversions.h"
26 #include "base/test/test_file_util.h" 26 #include "base/test/test_file_util.h"
27 #include "base/time.h" 27 #include "base/time.h"
28 #include "chrome/app/chrome_dll_resource.h" 28 #include "chrome/app/chrome_dll_resource.h"
29 #include "chrome/browser/net/url_fixer_upper.h" 29 #include "chrome/browser/net/url_fixer_upper.h"
30 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
31 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/debug_flags.h" 33 #include "chrome/common/debug_flags.h"
34 #include "chrome/common/logging_chrome.h" 34 #include "chrome/common/logging_chrome.h"
35 #include "chrome/common/json_value_serializer.h" 35 #include "chrome/common/json_value_serializer.h"
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 731
732 DictionaryValue* UITestBase::GetLocalState() { 732 DictionaryValue* UITestBase::GetLocalState() {
733 FilePath local_state_path; 733 FilePath local_state_path;
734 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 734 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
735 return LoadDictionaryValueFromPath(local_state_path); 735 return LoadDictionaryValueFromPath(local_state_path);
736 } 736 }
737 737
738 DictionaryValue* UITestBase::GetDefaultProfilePreferences() { 738 DictionaryValue* UITestBase::GetDefaultProfilePreferences() {
739 FilePath path; 739 FilePath path;
740 PathService::Get(chrome::DIR_USER_DATA, &path); 740 PathService::Get(chrome::DIR_USER_DATA, &path);
741 path = path.AppendASCII(WideToASCII(chrome::kNotSignedInProfile)); 741 path = path.AppendASCII(WideToUTF8(chrome::kNotSignedInProfile));
742 return LoadDictionaryValueFromPath(path.Append(chrome::kPreferencesFilename)); 742 return LoadDictionaryValueFromPath(path.Append(chrome::kPreferencesFilename));
743 } 743 }
744 744
745 int UITestBase::GetTabCount() { 745 int UITestBase::GetTabCount() {
746 return GetTabCount(0); 746 return GetTabCount(0);
747 } 747 }
748 748
749 int UITestBase::GetTabCount(int window_index) { 749 int UITestBase::GetTabCount(int window_index) {
750 scoped_refptr<BrowserProxy> window( 750 scoped_refptr<BrowserProxy> window(
751 automation()->GetBrowserWindow(window_index)); 751 automation()->GetBrowserWindow(window_index));
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 // actual thumbnails on the NTP. 1221 // actual thumbnails on the NTP.
1222 sql::Connection db; 1222 sql::Connection db;
1223 FilePath history = 1223 FilePath history =
1224 user_data_dir().AppendASCII("Default").AppendASCII("History"); 1224 user_data_dir().AppendASCII("Default").AppendASCII("History");
1225 // Not all test profiles have a history file. 1225 // Not all test profiles have a history file.
1226 if (!file_util::PathExists(history)) 1226 if (!file_util::PathExists(history))
1227 return; 1227 return;
1228 1228
1229 ASSERT_TRUE(db.Open(history)); 1229 ASSERT_TRUE(db.Open(history));
1230 Time yesterday = Time::Now() - TimeDelta::FromDays(1); 1230 Time yesterday = Time::Now() - TimeDelta::FromDays(1);
1231 std::string yesterday_str = Int64ToString(yesterday.ToInternalValue()); 1231 std::string yesterday_str = base::Int64ToString(yesterday.ToInternalValue());
1232 std::string query = StringPrintf( 1232 std::string query = StringPrintf(
1233 "UPDATE segment_usage " 1233 "UPDATE segment_usage "
1234 "SET time_slot = %s " 1234 "SET time_slot = %s "
1235 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);", 1235 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);",
1236 yesterday_str.c_str()); 1236 yesterday_str.c_str());
1237 ASSERT_TRUE(db.Execute(query.c_str())); 1237 ASSERT_TRUE(db.Execute(query.c_str()));
1238 db.Close(); 1238 db.Close();
1239 file_util::EvictFileFromSystemCache(history); 1239 file_util::EvictFileFromSystemCache(history);
1240 } 1240 }
1241 1241
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 set_ui_test_name(ASCIIToWide(test_name)); 1516 set_ui_test_name(ASCIIToWide(test_name));
1517 } 1517 }
1518 UITestBase::SetUp(); 1518 UITestBase::SetUp();
1519 PlatformTest::SetUp(); 1519 PlatformTest::SetUp();
1520 } 1520 }
1521 1521
1522 void UITest::TearDown() { 1522 void UITest::TearDown() {
1523 UITestBase::TearDown(); 1523 UITestBase::TearDown();
1524 PlatformTest::TearDown(); 1524 PlatformTest::TearDown();
1525 } 1525 }
OLDNEW
« no previous file with comments | « chrome/test/ui/ui_layout_test.cc ('k') | chrome_frame/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698