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

Unified Diff: chrome/test/perf/rendering/throughput_tests.cc

Issue 9533016: Add throughput_test support for file URLs in JSON input file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/perf/rendering/throughput_tests.cc
diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc
index 6faa8e5fdda38e379ffa377f08d91ab6dbeb47d2..d33c08334baf625af937fc8ffe16b3205acb95d9 100644
--- a/chrome/test/perf/rendering/throughput_tests.cc
+++ b/chrome/test/perf/rendering/throughput_tests.cc
@@ -12,6 +12,7 @@
#include "base/string_number_conversions.h"
#include "base/test/trace_event_analyzer.h"
#include "base/values.h"
+#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -70,17 +71,32 @@ class ThroughputTest : public BrowserPerfTest {
root.reset(base::JSONReader::Read(json, false));
ListValue* root_list = NULL;
- if (!root.get() || !root->GetAsList(&root_list))
+ if (!root.get() || !root->GetAsList(&root_list)) {
+ LOG(ERROR) << "JSON missing root list element";
return false;
+ }
DictionaryValue* item = NULL;
- if (!root_list->GetDictionary(index, &item))
+ if (!root_list->GetDictionary(index, &item)) {
+ LOG(ERROR) << "index " << index << " not found in JSON";
return false;
+ }
std::string str;
- if (!item->GetStringASCII("url", &str))
+ if (item->GetStringASCII("url", &str)) {
+ gurl_ = GURL(str);
+ } else if (item->GetStringASCII("file", &str)) {
+ FilePath empty;
+ gurl_ = URLFixerUpper::FixupRelativeFile(empty, empty.AppendASCII(str));
+ } else {
+ LOG(ERROR) << "missing url or file";
return false;
- gurl_ = GURL(str);
+ }
+
+ if (!gurl_.is_valid()) {
+ LOG(ERROR) << "invalid url: " << gurl_.possibly_invalid_spec();
+ return false;
+ }
FilePath::StringType cache_dir;
if (item->GetString("local_path", &cache_dir))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698