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

Side by Side Diff: chrome_frame/test/reliability/page_load_test.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/net/fake_external_tab.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) 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 // This file provides reliablity tests which run for ChromeFrame. 5 // This file provides reliablity tests which run for ChromeFrame.
6 // 6 //
7 // Usage: 7 // Usage:
8 // <reliability test exe> --list=file --startline=start --endline=end [...] 8 // <reliability test exe> --list=file --startline=start --endline=end [...]
9 // Upon invocation, it visits each of the URLs on line numbers between start 9 // Upon invocation, it visits each of the URLs on line numbers between start
10 // and end, inclusive, stored in the input file. The line number starts from 1. 10 // and end, inclusive, stored in the input file. The line number starts from 1.
(...skipping 17 matching lines...) Expand all
28 #include "base/file_version_info.h" 28 #include "base/file_version_info.h"
29 #include "base/i18n/time_formatting.h" 29 #include "base/i18n/time_formatting.h"
30 #include "base/path_service.h" 30 #include "base/path_service.h"
31 #include "base/prefs/json_pref_store.h" 31 #include "base/prefs/json_pref_store.h"
32 #include "base/string_number_conversions.h" 32 #include "base/string_number_conversions.h"
33 #include "base/string_util.h" 33 #include "base/string_util.h"
34 #include "base/test/test_file_util.h" 34 #include "base/test/test_file_util.h"
35 #include "base/time.h" 35 #include "base/time.h"
36 #include "base/utf_string_conversions.h" 36 #include "base/utf_string_conversions.h"
37 #include "chrome/browser/net/url_fixer_upper.h" 37 #include "chrome/browser/net/url_fixer_upper.h"
38 #include "chrome/browser/prefs/pref_registry_simple.h"
38 #include "chrome/browser/prefs/pref_service.h" 39 #include "chrome/browser/prefs/pref_service.h"
39 #include "chrome/browser/prefs/pref_service_mock_builder.h" 40 #include "chrome/browser/prefs/pref_service_mock_builder.h"
40 #include "chrome/browser/prefs/pref_value_store.h" 41 #include "chrome/browser/prefs/pref_value_store.h"
41 #include "chrome/common/automation_messages.h" 42 #include "chrome/common/automation_messages.h"
42 #include "chrome/common/chrome_constants.h" 43 #include "chrome/common/chrome_constants.h"
43 #include "chrome/common/chrome_paths.h" 44 #include "chrome/common/chrome_paths.h"
44 #include "chrome/common/chrome_paths_internal.h" 45 #include "chrome/common/chrome_paths_internal.h"
45 #include "chrome/common/chrome_switches.h" 46 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/logging_chrome.h" 47 #include "chrome/common/logging_chrome.h"
47 #include "chrome/common/pref_names.h" 48 #include "chrome/common/pref_names.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 num_dumps++; 422 num_dumps++;
422 } 423 }
423 } 424 }
424 if (metrics) 425 if (metrics)
425 metrics->crash_dump_count = num_dumps; 426 metrics->crash_dump_count = num_dumps;
426 } 427 }
427 428
428 // Get a PrefService whose contents correspond to the Local State file 429 // Get a PrefService whose contents correspond to the Local State file
429 // that was saved by the app as it closed. The caller takes ownership of the 430 // that was saved by the app as it closed. The caller takes ownership of the
430 // returned PrefService object. 431 // returned PrefService object.
431 PrefServiceSimple* GetLocalState() { 432 PrefService* GetLocalState(PrefRegistry* registry) {
432 FilePath path; 433 FilePath path;
433 chrome::GetChromeFrameUserDataDirectory(&path); 434 chrome::GetChromeFrameUserDataDirectory(&path);
434 PrefServiceMockBuilder builder; 435 PrefServiceMockBuilder builder;
435 builder.WithUserFilePrefs( 436 builder.WithUserFilePrefs(
436 path, 437 path,
437 JsonPrefStore::GetTaskRunnerForFile( 438 JsonPrefStore::GetTaskRunnerForFile(
438 path, content::BrowserThread::GetBlockingPool())); 439 path, content::BrowserThread::GetBlockingPool()));
439 return builder.CreateSimple(); 440 return builder.Create(registry);
440 } 441 }
441 442
442 void GetStabilityMetrics(NavigationMetrics* metrics) { 443 void GetStabilityMetrics(NavigationMetrics* metrics) {
443 if (!metrics) 444 if (!metrics)
444 return; 445 return;
445 scoped_ptr<PrefServiceSimple> local_state(GetLocalState()); 446 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple();
447 registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false);
448 registry->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1);
449 registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1);
450 registry->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
451 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
452
453 scoped_ptr<PrefService> local_state(GetLocalState(registry));
446 if (!local_state.get()) 454 if (!local_state.get())
447 return; 455 return;
448 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false);
449 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1);
450 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1);
451 local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
452 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
453 456
454 metrics->browser_clean_exit = 457 metrics->browser_clean_exit =
455 local_state->GetBoolean(prefs::kStabilityExitedCleanly); 458 local_state->GetBoolean(prefs::kStabilityExitedCleanly);
456 metrics->browser_launch_count = 459 metrics->browser_launch_count =
457 local_state->GetInteger(prefs::kStabilityLaunchCount); 460 local_state->GetInteger(prefs::kStabilityLaunchCount);
458 metrics->page_load_count = 461 metrics->page_load_count =
459 local_state->GetInteger(prefs::kStabilityPageLoadCount); 462 local_state->GetInteger(prefs::kStabilityPageLoadCount);
460 metrics->browser_crash_count = 463 metrics->browser_crash_count =
461 local_state->GetInteger(prefs::kStabilityCrashCount); 464 local_state->GetInteger(prefs::kStabilityCrashCount);
462 metrics->renderer_crash_count = 465 metrics->renderer_crash_count =
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); 588 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags));
586 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { 589 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) {
587 g_v8_log_path = v8_command_line.GetSwitchValuePath(kV8LogFileSwitch); 590 g_v8_log_path = v8_command_line.GetSwitchValuePath(kV8LogFileSwitch);
588 if (!file_util::AbsolutePath(&g_v8_log_path)) 591 if (!file_util::AbsolutePath(&g_v8_log_path))
589 g_v8_log_path = FilePath(); 592 g_v8_log_path = FilePath();
590 } 593 }
591 } 594 }
592 } 595 }
593 } 596 }
594 } 597 }
OLDNEW
« no previous file with comments | « chrome_frame/test/net/fake_external_tab.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698