OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <set> | 5 #include <set> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 BrowserProcessFilter filter(L""); | 490 BrowserProcessFilter filter(L""); |
491 return base::GetProcessCount(chrome::kBrowserProcessExecutableName, | 491 return base::GetProcessCount(chrome::kBrowserProcessExecutableName, |
492 &filter); | 492 &filter); |
493 } | 493 } |
494 | 494 |
495 static DictionaryValue* LoadDictionaryValueFromPath(const std::wstring& path) { | 495 static DictionaryValue* LoadDictionaryValueFromPath(const std::wstring& path) { |
496 if (path.empty()) | 496 if (path.empty()) |
497 return NULL; | 497 return NULL; |
498 | 498 |
499 JSONFileValueSerializer serializer(path); | 499 JSONFileValueSerializer serializer(path); |
500 Value* root_value = NULL; | 500 scoped_ptr<Value> root_value(serializer.Deserialize(NULL)); |
501 if (serializer.Deserialize(&root_value, NULL) && | 501 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY) |
502 root_value->GetType() != Value::TYPE_DICTIONARY) { | |
503 delete root_value; | |
504 return NULL; | 502 return NULL; |
505 } | 503 |
506 return static_cast<DictionaryValue*>(root_value); | 504 return static_cast<DictionaryValue*>(root_value.release()); |
507 } | 505 } |
508 | 506 |
509 DictionaryValue* UITest::GetLocalState() { | 507 DictionaryValue* UITest::GetLocalState() { |
510 std::wstring local_state_path; | 508 std::wstring local_state_path; |
511 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 509 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
512 return LoadDictionaryValueFromPath(local_state_path); | 510 return LoadDictionaryValueFromPath(local_state_path); |
513 } | 511 } |
514 | 512 |
515 DictionaryValue* UITest::GetDefaultProfilePreferences() { | 513 DictionaryValue* UITest::GetDefaultProfilePreferences() { |
516 std::wstring path; | 514 std::wstring path; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 const std::wstring& units, | 712 const std::wstring& units, |
715 bool important) { | 713 bool important) { |
716 // <*>RESULT <graph_name>: <trace_name>= <value> <units> | 714 // <*>RESULT <graph_name>: <trace_name>= <value> <units> |
717 // <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units> | 715 // <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units> |
718 // <*>RESULT <graph_name>: <trace_name>= [<value>,value,value,...,] <units> | 716 // <*>RESULT <graph_name>: <trace_name>= [<value>,value,value,...,] <units> |
719 wprintf(L"%lsRESULT %ls%ls: %ls= %ls%ls%ls %ls\n", | 717 wprintf(L"%lsRESULT %ls%ls: %ls= %ls%ls%ls %ls\n", |
720 important ? L"*" : L"", measurement.c_str(), modifier.c_str(), | 718 important ? L"*" : L"", measurement.c_str(), modifier.c_str(), |
721 trace.c_str(), prefix.c_str(), values.c_str(), suffix.c_str(), | 719 trace.c_str(), prefix.c_str(), values.c_str(), suffix.c_str(), |
722 units.c_str()); | 720 units.c_str()); |
723 } | 721 } |
OLD | NEW |