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

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

Issue 255036: Adding a SIGTERM handler for OS_POSIX builds. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/browser/browser_uitest.cc ('k') | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return base::CrashAwareSleep(process_, time_out_ms); 593 return base::CrashAwareSleep(process_, time_out_ms);
594 } 594 }
595 595
596 // static 596 // static
597 int UITest::GetBrowserProcessCount() { 597 int UITest::GetBrowserProcessCount() {
598 FilePath data_dir; 598 FilePath data_dir;
599 PathService::Get(chrome::DIR_USER_DATA, &data_dir); 599 PathService::Get(chrome::DIR_USER_DATA, &data_dir);
600 return GetRunningChromeProcesses(data_dir).size(); 600 return GetRunningChromeProcesses(data_dir).size();
601 } 601 }
602 602
603 #if defined(OS_WIN)
604 // TODO(port): Port GetRunningChromeProcesses and sort out one w/string issue.
605 static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) { 603 static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) {
606 if (path.empty()) 604 if (path.empty())
607 return NULL; 605 return NULL;
608 606
609 JSONFileValueSerializer serializer(path); 607 JSONFileValueSerializer serializer(path);
610 scoped_ptr<Value> root_value(serializer.Deserialize(NULL)); 608 scoped_ptr<Value> root_value(serializer.Deserialize(NULL));
611 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY) 609 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY)
612 return NULL; 610 return NULL;
613 611
614 return static_cast<DictionaryValue*>(root_value.release()); 612 return static_cast<DictionaryValue*>(root_value.release());
615 } 613 }
616 614
617 DictionaryValue* UITest::GetLocalState() { 615 DictionaryValue* UITest::GetLocalState() {
618 FilePath local_state_path; 616 FilePath local_state_path;
619 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 617 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
620 return LoadDictionaryValueFromPath(local_state_path); 618 return LoadDictionaryValueFromPath(local_state_path);
621 } 619 }
622 620
623 DictionaryValue* UITest::GetDefaultProfilePreferences() { 621 DictionaryValue* UITest::GetDefaultProfilePreferences() {
624 std::wstring path; 622 std::wstring path_wstring;
625 PathService::Get(chrome::DIR_USER_DATA, &path); 623 PathService::Get(chrome::DIR_USER_DATA, &path_wstring);
626 file_util::AppendToPath(&path, chrome::kNotSignedInProfile); 624 file_util::AppendToPath(&path_wstring, chrome::kNotSignedInProfile);
627 file_util::AppendToPath(&path, chrome::kPreferencesFilename); 625 FilePath path(FilePath::FromWStringHack(path_wstring));
628 return LoadDictionaryValueFromPath(FilePath::FromWStringHack(path)); 626 return LoadDictionaryValueFromPath(path.Append(chrome::kPreferencesFilename));
629 } 627 }
630 #endif // OS_WIN
631 628
632 int UITest::GetTabCount() { 629 int UITest::GetTabCount() {
633 scoped_refptr<BrowserProxy> first_window(automation()->GetBrowserWindow(0)); 630 scoped_refptr<BrowserProxy> first_window(automation()->GetBrowserWindow(0));
634 if (!first_window.get()) 631 if (!first_window.get())
635 return 0; 632 return 0;
636 633
637 int result = 0; 634 int result = 0;
638 EXPECT_TRUE(first_window->GetTabCount(&result)); 635 EXPECT_TRUE(first_window->GetTabCount(&result));
639 636
640 return result; 637 return result;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 #else 1120 #else
1124 // TODO(port): above code is very Windows-specific; we need to 1121 // TODO(port): above code is very Windows-specific; we need to
1125 // figure out and abstract out how we'll handle finding any existing 1122 // figure out and abstract out how we'll handle finding any existing
1126 // running process, etc. on other platforms. 1123 // running process, etc. on other platforms.
1127 NOTIMPLEMENTED(); 1124 NOTIMPLEMENTED();
1128 #endif 1125 #endif
1129 } 1126 }
1130 1127
1131 return true; 1128 return true;
1132 } 1129 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698