diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-04 16:50:51 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-04 16:50:51 +0000 |
commit | 498160bba533677d2e07b863e762b2e36e416f2f (patch) | |
tree | aeb996c2500d93c3a3fdc7391e8c421ba7991fe9 | |
parent | 16194f430b5f1ed6a4fdf81e5baef77e22d3c8ff (diff) | |
download | chromium_src-498160bba533677d2e07b863e762b2e36e416f2f.zip chromium_src-498160bba533677d2e07b863e762b2e36e416f2f.tar.gz chromium_src-498160bba533677d2e07b863e762b2e36e416f2f.tar.bz2 |
Remove page cyclers from chrome binary.
The page cyclers run with Telemetry now. They should not be baked into the chrome
binary itself. This causes unwanted dependencies on test code and bloats the
binary.
BUG=280157
Review URL: https://chromiumcodereview.appspot.com/23498004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221201 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 26 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main.h | 5 | ||||
-rw-r--r-- | chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc | 1 | ||||
-rw-r--r-- | chrome/browser/page_cycler/page_cycler.cc | 268 | ||||
-rw-r--r-- | chrome/browser/page_cycler/page_cycler.h | 154 | ||||
-rw-r--r-- | chrome/browser/page_cycler/page_cycler_browsertest.cc | 398 | ||||
-rw-r--r-- | chrome/browser/page_cycler/page_cycler_unittest.cc | 352 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl_io_data.cc | 10 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 11 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 12 | ||||
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 6 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/test/perf/perf_test.gyp | 18 | ||||
-rw-r--r-- | chrome_frame/chrome_frame.gyp | 2 |
15 files changed, 33 insertions, 1234 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 8f70eff..26258d6 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -75,7 +75,6 @@ #include "chrome/browser/net/crl_set_fetcher.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/notifications/desktop_notification_service_factory.h" -#include "chrome/browser/page_cycler/page_cycler.h" #include "chrome/browser/performance_monitor/performance_monitor.h" #include "chrome/browser/performance_monitor/startup_timer.h" #include "chrome/browser/plugins/plugin_prefs.h" @@ -1094,11 +1093,6 @@ void ChromeBrowserMainParts::PreBrowserStart() { void ChromeBrowserMainParts::PostBrowserStart() { TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostBrowserStart"); -#if !defined(OS_ANDROID) - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs)) - RunPageCycler(); -#endif - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) chrome_extra_parts_[i]->PostBrowserStart(); #if !defined(OS_ANDROID) @@ -1107,26 +1101,6 @@ void ChromeBrowserMainParts::PostBrowserStart() { #endif } -#if !defined(OS_ANDROID) -void ChromeBrowserMainParts::RunPageCycler() { - CommandLine* command_line = CommandLine::ForCurrentProcess(); - Browser* browser = chrome::FindBrowserWithProfile(profile_, - chrome::GetActiveDesktop()); - DCHECK(browser); - PageCycler* page_cycler = NULL; - base::FilePath input_file = - command_line->GetSwitchValuePath(switches::kVisitURLs); - page_cycler = new PageCycler(browser, input_file); - page_cycler->set_errors_file( - input_file.AddExtension(FILE_PATH_LITERAL(".errors"))); - if (command_line->HasSwitch(switches::kRecordStats)) { - page_cycler->set_stats_file( - command_line->GetSwitchValuePath(switches::kRecordStats)); - } - page_cycler->Run(); -} -#endif // !defined(OS_ANDROID) - void ChromeBrowserMainParts::SetupPlatformFieldTrials() { // Base class implementation of this does nothing. } diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index f143bc5..22c4526 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h @@ -79,11 +79,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { virtual void PreBrowserStart(); virtual void PostBrowserStart(); -#if !defined(OS_ANDROID) - // Runs the PageCycler; called if the switch kVisitURLs is present. - virtual void RunPageCycler(); -#endif - // Override this in subclasses to initialize platform specific field trials. virtual void SetupPlatformFieldTrials(); diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc index 5b86a07..c759e56 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc @@ -25,7 +25,6 @@ #include "chrome/test/base/test_launcher_utils.h" #include "chrome/test/base/test_switches.h" #include "chrome/test/base/tracing.h" -#include "chrome/test/perf/perf_test.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/content_switches.h" diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc deleted file mode 100644 index e78f100..0000000 --- a/chrome/browser/page_cycler/page_cycler.cc +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/page_cycler/page_cycler.h" - -#include "base/bind.h" -#include "base/file_util.h" -#include "base/files/file_path.h" -#include "base/message_loop/message_loop.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_split.h" -#include "base/strings/utf_string_conversions.h" -#include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/test/base/chrome_process_util.h" -#include "chrome/test/perf/perf_test.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/web_contents.h" -#include "content/public/common/url_constants.h" -#include "testing/perf/perf_test.h" - -using content::NavigationController; -using content::OpenURLParams; -using content::Referrer; -using content::WebContents; - -PageCycler::PageCycler(Browser* browser, - const base::FilePath& urls_file) - : content::WebContentsObserver( - browser->tab_strip_model()->GetActiveWebContents()), - browser_(browser), - urls_file_(urls_file), - url_index_(0), - aborted_(false) { - BrowserList::AddObserver(this); - AddRef(); // Balanced in Finish()/Abort() (only one should be called). -} - -PageCycler::~PageCycler() { -} - -bool PageCycler::IsLoadCallbackValid(const GURL& validated_url, - bool is_main_frame) { - // If |url_index_| is equal to zero, that means that this was called before - // LoadNextURL() - this can happen at startup, loading the new tab page; or - // if the user specified a bad url as the final url in the list. In these - // cases, do not report success or failure, and load the next page. - if (!url_index_) { - LoadNextURL(); - return false; - } - return (is_main_frame && - validated_url.spec() != content::kUnreachableWebDataURL); -} - -void PageCycler::DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) { - if (IsLoadCallbackValid(validated_url, is_main_frame)) - LoadSucceeded(); -} - -void PageCycler::DidFailProvisionalLoad( - int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - int error_code, - const string16& error_description, - content::RenderViewHost* render_view_host) { - if (IsLoadCallbackValid(validated_url, is_main_frame)) - LoadFailed(validated_url, error_description); -} - -void PageCycler::Run() { - if (browser_) - content::BrowserThread::PostBlockingPoolTask( - FROM_HERE, - base::Bind(&PageCycler::ReadURLsOnBackgroundThread, this)); -} - -void PageCycler::ReadURLsOnBackgroundThread() { - CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - - std::string file_contents; - std::vector<std::string> url_strings; - - CHECK(base::PathExists(urls_file_)) << urls_file_.value(); - base::ReadFileToString(urls_file_, &file_contents); - base::SplitStringAlongWhitespace(file_contents, &url_strings); - - if (!url_strings.size()) { -#if defined(OS_POSIX) - error_.append(ASCIIToUTF16("Page Cycler: No URLs in given file: " + - urls_file_.value())); -#elif defined(OS_WIN) - error_.append(ASCIIToUTF16("Page Cycler: No URLs in given file: ")) - .append(urls_file_.value()); -#endif // OS_WIN - } - - for (std::vector<std::string>::const_iterator iter = url_strings.begin(); - iter != url_strings.end(); ++iter) { - GURL gurl(*iter); - if (!gurl.is_valid()) - error_.append(ASCIIToUTF16("Omitting invalid URL: " + *iter + ".\n")); - // Since we don't count kUnreachableWebData as a valid load, we don't want - // the user to specify this as one of the pages to visit. - else if (*iter == content::kUnreachableWebDataURL) { - error_.append(ASCIIToUTF16( - "Chrome error pages are not allowed as urls. Omitting url: " + - *iter + ".\n")); - } else { - urls_.push_back(gurl); - } - } - - content::BrowserThread::PostTask(content::BrowserThread::UI, - FROM_HERE, - base::Bind(&PageCycler::BeginCycle, this)); -} - -void PageCycler::BeginCycle() { - CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - - CHECK(browser_); - // Upon launch, Chrome will automatically load the newtab page. This can - // result in the browser being in a state of loading when PageCycler is ready - // to start. Instead of interrupting the load, we wait for it to finish, and - // will call LoadNextURL() from DidFinishLoad() or DidFailProvisionalLoad(). - if (browser_->tab_strip_model()->GetActiveWebContents()->IsLoading()) - return; - LoadNextURL(); -} - -void PageCycler::LoadNextURL() { - CHECK(browser_); - if (url_index_ >= urls_.size()) { - content::BrowserThread::PostBlockingPoolTask( - FROM_HERE, - base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); - return; - } - if (url_index_) { - timings_string_.append(", "); - urls_string_.append(", "); - } - urls_string_.append(urls_[url_index_].spec()); - initial_time_ = base::TimeTicks::HighResNow(); - OpenURLParams params(urls_[url_index_], - Referrer(), - CURRENT_TAB, - content::PAGE_TRANSITION_TYPED, - false); - ++url_index_; - browser_->OpenURL(params); -} - -void PageCycler::LoadSucceeded() { - base::TimeDelta time_elapsed = - (base::TimeTicks::HighResNow() - initial_time_) / 1000.0; - timings_string_.append(base::Int64ToString(time_elapsed.ToInternalValue())); - LoadNextURL(); -} - -void PageCycler::LoadFailed(const GURL& url, - const string16& error_description) { - error_.append(ASCIIToUTF16("Failed to load the page at: " + - url.spec() + ": ")).append(error_description). - append(ASCIIToUTF16("\n")); - base::TimeDelta time_elapsed = - (base::TimeTicks::HighResNow() - initial_time_) / 1000.0; - timings_string_.append(base::Int64ToString(time_elapsed.ToInternalValue()) + - (" (failed)")); - LoadNextURL(); -} - -void PageCycler::PrepareResultsOnBackgroundThread() { - CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - std::string output; - if (!stats_file_.empty()) { -#if defined(OS_POSIX) - base::ProcessId pid = base::GetParentProcessId(base::GetCurrentProcId()); -#elif defined(OS_WIN) - base::ProcessId pid = base::GetCurrentProcId(); -#endif // OS_WIN - ChromeProcessList chrome_processes(GetRunningChromeProcesses(pid)); - output += perf_test::MemoryUsageInfoToString( - std::string(), chrome_processes, pid); - output += - perf_test::IOPerfInfoToString(std::string(), chrome_processes, pid); - output += perf_test::SystemCommitChargeToString( - std::string(), base::GetSystemCommitCharge(), false); - output.append("Pages: [" + urls_string_ + "]\n"); - output.append("*RESULT times: t_ref= [" + timings_string_ + "] ms\n"); - } - WriteResultsOnBackgroundThread(output); -} - -void PageCycler::WriteResultsOnBackgroundThread(const std::string& output) { - CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - - if (!output.empty()) { - CHECK(!stats_file_.empty()); - if (base::PathExists(stats_file_)) { - VLOG(1) << "PageCycler: Previous stats file found; appending."; - file_util::AppendToFile(stats_file_, output.c_str(), output.size()); - } else { - file_util::WriteFile(stats_file_, output.c_str(), output.size()); - } - } - if (!errors_file_.empty()) { - if (!error_.empty()) { - file_util::WriteFile(errors_file_, UTF16ToUTF8(error_).c_str(), - error_.size()); - } else if (base::PathExists(errors_file_)) { - // If there is an old error file, delete it to avoid confusion. - base::DeleteFile(errors_file_, false); - } - } - if (aborted_) { - content::BrowserThread::PostTask(content::BrowserThread::UI, - FROM_HERE, - base::Bind(&PageCycler::Abort, this)); - } else { - content::BrowserThread::PostTask(content::BrowserThread::UI, - FROM_HERE, - base::Bind(&PageCycler::Finish, this)); - } -} - -void PageCycler::Finish() { - CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - BrowserList::RemoveObserver(this); - browser_->OnWindowClosing(); - chrome::ExecuteCommand(browser_, IDC_EXIT); - Release(); // Balanced in PageCycler constructor; - // (only one of Finish/Abort should be called). -} - -void PageCycler::Abort() { - browser_ = NULL; - BrowserList::RemoveObserver(this); - Release(); // Balanced in PageCycler constructor; - // (only one of Finish/Abort should be called). -} - -void PageCycler::OnBrowserAdded(Browser* browser) {} - -void PageCycler::OnBrowserRemoved(Browser* browser) { - if (browser == browser_) { - aborted_ = true; - error_.append(ASCIIToUTF16( - "Browser was closed before the run was completed.")); - DLOG(WARNING) << - "Page Cycler: browser was closed before the run was completed."; - content::BrowserThread::PostBlockingPoolTask( - FROM_HERE, - base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); - } -} diff --git a/chrome/browser/page_cycler/page_cycler.h b/chrome/browser/page_cycler/page_cycler.h deleted file mode 100644 index 5212da9..0000000 --- a/chrome/browser/page_cycler/page_cycler.h +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ -#define CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ - -#include "base/files/file_path.h" -#include "base/memory/ref_counted.h" -#include "chrome/browser/ui/browser_list_observer.h" -#include "content/public/browser/navigation_controller.h" -#include "content/public/browser/web_contents_observer.h" - -class Browser; - -namespace content { -class RenderViewHost; -} // namespace content - -namespace base { -class TimeTicks; -} // namespace base - -// Performance test to track the resources used and speed with which chromium -// fully loads a given set of URLs. This class is created on the UI thread and -// does most of its work there. However, some work happens on background threads -// too; those are named with 'OnBackgroundThread'. -class PageCycler : public base::RefCountedThreadSafe<PageCycler>, - public chrome::BrowserListObserver, - public content::WebContentsObserver { - public: - PageCycler(Browser* browser, const base::FilePath& urls_file); - - // Begin running the page cycler. - void Run(); - - // content::WebContentsObserver - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DidFailProvisionalLoad( - int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - int error_code, - const string16& error_description, - content::RenderViewHost* render_view_host) OVERRIDE; - - // This method should never be necessary while running PageCycler; this is - // for testing purposes only. - const std::vector<GURL>* urls_for_test() { return &urls_; } - - void set_stats_file(const base::FilePath& stats_file) { - stats_file_ = stats_file; - } - void set_errors_file(const base::FilePath& errors_file) { - errors_file_ = errors_file; - } - - - protected: - virtual ~PageCycler(); - - private: - friend class base::RefCountedThreadSafe<PageCycler>; - friend class MockPageCycler; - - // Check to see if a load callback is valid; i.e. the load should be from the - // main frame, the url should not be a chrome error url, and |url_index| - // should not be 0. - bool IsLoadCallbackValid(const GURL& validated_url, - bool is_main_frame); - - // Read in the urls from |urls_file_| and store them in |urls_|. - void ReadURLsOnBackgroundThread(); - - // Perform any initial setup neccessary, and begin visiting the pages. - void BeginCycle(); - - // If |url_index_| points to a valid position in |urls_|, load the url, - // capturing any statistics information. Otherwise, call WriteResults. - void LoadNextURL(); - - // Complete statistics gathering for the finished visit, and try to load the - // next url. - void LoadSucceeded(); - - // Inidicate that the load failed with an error; try to load the next url. - void LoadFailed(const GURL& url, const string16& error_description); - - // Finalize the output strings. - void PrepareResultsOnBackgroundThread(); - - // Write the data stored within |output| to the file indicated by - // |stats_file_|, if |stats_file_| is not empty. Write any errors to - // |errors_file_|. - void WriteResultsOnBackgroundThread(const std::string& output); - - // Perform any necessary cleanup and exit |browser_|; virtual since tests may - // need to override this function. - virtual void Finish(); - - // Called when the Browser to which |browser_| points is closed; exits - // PageCycler. - void Abort(); - - // chrome::BrowserListObserver - virtual void OnBrowserAdded(Browser* browser) OVERRIDE; - virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; - - // The Browser context in which the page cycler is running. - Browser* browser_; - - // The path to the file containing the list of urls to visit. - base::FilePath urls_file_; - - // The path to the file to which we write any errors encountered. - base::FilePath errors_file_; - - // The path to the file to which we write the statistics (optional, may be - // an empty path). - base::FilePath stats_file_; - - // The list of urls to visit. - std::vector<GURL> urls_; - - // The current index into the |urls_| vector. - size_t url_index_; - - // The generated string of urls which we have visited; this is built one url - // at a time as we iterate through the |urls_| vector. This is primarily - // included for interfacing with the previous page_cycler's output style. - std::string urls_string_; - - // The generated string of the times taken to visit each url. As with - // |urls_string_|, this is built as we visit each url, and is primarily to - // produce output similar to the previous page_cycler's. - std::string timings_string_; - - // The time at which we begin the process of loading the next url; this is - // used to calculate the time taken for each url load. - base::TimeTicks initial_time_; - - // Indicates the abort status of the page cycler; true means aborted. - bool aborted_; - - string16 error_; - - DISALLOW_COPY_AND_ASSIGN(PageCycler); -}; - -#endif // CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ diff --git a/chrome/browser/page_cycler/page_cycler_browsertest.cc b/chrome/browser/page_cycler/page_cycler_browsertest.cc deleted file mode 100644 index 5e6dbef..0000000 --- a/chrome/browser/page_cycler/page_cycler_browsertest.cc +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/command_line.h" -#include "base/file_util.h" -#include "base/files/file_path.h" -#include "base/path_service.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "base/threading/sequenced_worker_pool.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/page_cycler/page_cycler.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" -#include "content/public/browser/notification_service.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" -#include "url/gurl.h" - -// TODO(kbr): remove: http://crbug.com/222296 -#if defined(OS_MACOSX) -#import "base/mac/mac_util.h" -#endif - -// Basic PageCyclerBrowserTest structure; used in testing most of PageCycler's -// functionality. -class PageCyclerBrowserTest : public content::NotificationObserver, - public InProcessBrowserTest { - public: - PageCyclerBrowserTest() : page_cycler_(NULL) { - } - - virtual ~PageCyclerBrowserTest() { - } - - // Initialize file paths within a temporary directory; this should be - // empty and nonexistent. - virtual void InitFilePaths(base::FilePath temp_path) { - temp_path_ = temp_path; - urls_file_ = temp_path.AppendASCII("urls_file"); - errors_file_ = temp_path.AppendASCII("errors"); - stats_file_ = temp_path.AppendASCII("stats"); - - ASSERT_FALSE(base::PathExists(urls_file_)); - ASSERT_FALSE(base::PathExists(errors_file_)); - ASSERT_FALSE(base::PathExists(stats_file_)); - } - - // Initialize a PageCycler using either the base fields, or using provided - // ones. - void InitPageCycler() { - page_cycler_ = new PageCycler(browser(), urls_file()); - page_cycler_->set_errors_file(errors_file()); - page_cycler_->set_stats_file(stats_file()); - } - - void InitPageCycler(base::FilePath urls_file, - base::FilePath errors_file, - base::FilePath stats_file) { - page_cycler_ = new PageCycler(browser(), urls_file); - page_cycler_->set_errors_file(errors_file); - page_cycler_->set_stats_file(stats_file); - } - - void RegisterForNotifications() { - registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, - content::NotificationService::AllSources()); - } - - // Get a collection of basic urls which are stored in the test directory. - // NOTE: |test_server| must be started first! - std::vector<GURL> GetURLs() { - std::vector<GURL> urls; - urls.push_back(test_server()->GetURL("files/page_cycler/basic_html.html")); - urls.push_back(test_server()->GetURL("files/page_cycler/basic_js.html")); - urls.push_back(test_server()->GetURL("files/page_cycler/basic_css.html")); - return urls; - } - - // Read the errors file, and generate a vector of error strings. - std::vector<std::string> GetErrorsFromFile() { - std::string error_file_contents; - CHECK(base::ReadFileToString(errors_file_, &error_file_contents)); - if (error_file_contents[error_file_contents.size() - 1] == '\n') - error_file_contents.resize(error_file_contents.size() - 1); - - std::vector<std::string> errors; - base::SplitString(error_file_contents, '\n', &errors); - - return errors; - } - - // Convert a vector of GURLs into a newline-separated string, ready to be - // written to the urls file for PageCycler to use. - std::string GetStringFromURLs(std::vector<GURL> urls) { - std::string urls_string; - for (std::vector<GURL>::const_iterator iter = urls.begin(); - iter != urls.end(); ++iter) - urls_string.append(iter->spec() + "\n"); - return urls_string; - } - - // content::NotificationObserver. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { - switch (type) { - case chrome::NOTIFICATION_BROWSER_CLOSED: - base::MessageLoop::current()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); - break; - default: - NOTREACHED(); - break; - } - } - - base::FilePath urls_file() { return urls_file_; } - base::FilePath errors_file() { return errors_file_; } - base::FilePath stats_file() { return stats_file_; } - PageCycler* page_cycler() { return page_cycler_; } - - protected: - base::FilePath temp_path_; - base::FilePath urls_file_; - base::FilePath errors_file_; - base::FilePath stats_file_; - PageCycler* page_cycler_; - content::NotificationRegistrar registrar_; -}; - -// Structure used for testing PageCycler's ability to playback a series of -// URLs given a cache directory. -class PageCyclerCachedBrowserTest : public PageCyclerBrowserTest { - public: - // For a cached test, we use the provided user data directory from the test - // directory. - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - base::FilePath test_dir; - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); - test_dir = test_dir.AppendASCII("page_cycler"); - - base::FilePath source_data_dir = test_dir.AppendASCII("cached_data_dir"); - CHECK(base::PathExists(source_data_dir)); - - CHECK(user_data_dir_.CreateUniqueTempDir()); - - base::FilePath dest_data_dir = - user_data_dir_.path().AppendASCII("cached_data_dir"); - CHECK(!base::PathExists(dest_data_dir)); - - CHECK(base::CopyDirectory(source_data_dir, user_data_dir_.path(), - true)); // recursive. - CHECK(base::PathExists(dest_data_dir)); - - command_line->AppendSwitchPath(switches::kUserDataDir, - dest_data_dir); - command_line->AppendSwitch(switches::kPlaybackMode); - } - - // Initialize the file paths to use the UserDataDir's urls file, instead - // of one to be written. - virtual void InitFilePaths(base::FilePath temp_path) OVERRIDE { - urls_file_ = user_data_dir_.path().AppendASCII("cached_data_dir") - .AppendASCII("urls"); - errors_file_ = temp_path.AppendASCII("errors"); - stats_file_ = temp_path.AppendASCII("stats"); - - ASSERT_TRUE(base::PathExists(urls_file_)); - ASSERT_FALSE(base::PathExists(errors_file_)); - ASSERT_FALSE(base::PathExists(stats_file_)); - } - - private: - // The directory storing the copy of the UserDataDir. - base::ScopedTempDir user_data_dir_; -}; - -// Sanity check; iterate through a series of URLs and make sure there are no -// errors. -IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, BasicTest) { - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - - RegisterForNotifications(); - InitFilePaths(temp.path()); - - ASSERT_TRUE(test_server()->Start()); - - std::string urls_string = GetStringFromURLs(GetURLs());; - - ASSERT_TRUE(file_util::WriteFile(urls_file(), urls_string.c_str(), - urls_string.size())); - - InitPageCycler(); - page_cycler()->Run(); - - content::RunMessageLoop(); - ASSERT_FALSE(base::PathExists(errors_file())); - ASSERT_TRUE(base::PathExists(stats_file())); -} - -// Test to make sure that PageCycler will recognize unvisitable URLs, and will -// handle them appropriately. -IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, UnvisitableURL) { - const size_t kNumErrors = 1; - const char kFakeURL[] = "http://www.pleasenoonehavethisurlanytimeinthenext" - "century.com/gibberish"; - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - - RegisterForNotifications(); - InitFilePaths(temp.path()); - - ASSERT_TRUE(test_server()->Start()); - - std::vector<GURL> urls = GetURLs(); - urls.push_back(GURL(kFakeURL)); - std::string urls_string = GetStringFromURLs(urls); - - ASSERT_TRUE(file_util::WriteFile(urls_file(), urls_string.c_str(), - urls_string.size())); - - InitPageCycler(); - page_cycler()->Run(); - - content::RunMessageLoop(); - ASSERT_TRUE(base::PathExists(errors_file())); - ASSERT_TRUE(base::PathExists(stats_file())); - - std::vector<std::string> errors = GetErrorsFromFile(); - - ASSERT_EQ(kNumErrors, errors.size()); - - // Check that each error message contains the fake URL (i.e., that it wasn't - // from a valid URL, and that the fake URL was caught each time). - ASSERT_NE(std::string::npos, errors[0].find(kFakeURL)); -} - -// Test that PageCycler will remove an invalid URL prior to running. -IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, InvalidURL) { - const char kBadURL[] = "notarealurl"; - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - - RegisterForNotifications(); - InitFilePaths(temp.path()); - - ASSERT_TRUE(test_server()->Start()); - - std::string urls_string = GetStringFromURLs(GetURLs()); - urls_string.append(kBadURL).append("\n"); - - ASSERT_TRUE(file_util::WriteFile(urls_file(), urls_string.c_str(), - urls_string.size())); - - InitPageCycler(); - page_cycler()->Run(); - - content::RunMessageLoop(); - ASSERT_TRUE(base::PathExists(errors_file())); - ASSERT_TRUE(base::PathExists(stats_file())); - - std::vector<std::string> errors = GetErrorsFromFile(); - ASSERT_EQ(1u, errors.size()); - - std::string expected_error = "Omitting invalid URL: "; - expected_error.append(kBadURL).append("."); - - ASSERT_FALSE(errors[0].compare(expected_error)); -} - -// Test that PageCycler will remove a Chrome Error URL prior to running. -IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, ChromeErrorURL) { - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - - RegisterForNotifications(); - InitFilePaths(temp.path()); - - ASSERT_TRUE(test_server()->Start()); - - std::vector<GURL> urls = GetURLs(); - urls.push_back(GURL(content::kUnreachableWebDataURL)); - std::string urls_string = GetStringFromURLs(urls); - - ASSERT_TRUE(file_util::WriteFile(urls_file(), urls_string.c_str(), - urls_string.size())); - - InitPageCycler(); - page_cycler()->Run(); - - content::RunMessageLoop(); - ASSERT_TRUE(base::PathExists(errors_file())); - ASSERT_TRUE(base::PathExists(stats_file())); - - std::vector<std::string> errors = GetErrorsFromFile(); - ASSERT_EQ(1u, errors.size()); - - std::string expected_error = "Chrome error pages are not allowed as urls. " - "Omitting url: "; - expected_error.append(content::kUnreachableWebDataURL).append("."); - - ASSERT_FALSE(errors[0].compare(expected_error)); -} - -#if !defined(OS_CHROMEOS) -// TODO(rdevlin.cronin): Perhaps page cycler isn't completely implemented on -// ChromeOS? - -// Test that PageCycler will visit all the urls from a cache directory -// successfully while in playback mode. -// Disabled due to flaky timeouts. Tracking bugs include -// [ http://crbug.com/159026 ], [ http://crbug.com/131333 ], and -// [ http://crbug.com/222296 ]. -IN_PROC_BROWSER_TEST_F(PageCyclerCachedBrowserTest, DISABLED_PlaybackMode) { -#if defined(OS_MACOSX) - // TODO(kbr): re-enable: http://crbug.com/222296 - if (base::mac::IsOSMountainLionOrLater()) - return; -#endif - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - - RegisterForNotifications(); - InitFilePaths(temp.path()); - - InitPageCycler(); - - page_cycler()->Run(); - - content::RunMessageLoop(); - ASSERT_TRUE(base::PathExists(stats_file())); - ASSERT_FALSE(base::PathExists(errors_file())); -} -#endif // !defined(OS_CHROMEOS) - -#if !defined(OS_CHROMEOS) -// TODO(rdevlin.cronin): Perhaps page cycler isn't completely implemented on -// ChromeOS? - -// Test that PageCycler will have a cache miss if a URL is missing from the -// cache directory while in playback mode. -// Bug 131333: This test fails on a XP debug bot since Build 17609. -#if (defined(OS_WIN) || defined(OS_MACOSX)) && !defined(NDEBUG) -#define MAYBE_URLNotInCache DISABLED_URLNotInCache -#else -#define MAYBE_URLNotInCache URLNotInCache -#endif -IN_PROC_BROWSER_TEST_F(PageCyclerCachedBrowserTest, MAYBE_URLNotInCache) { - const char kCacheMissURL[] = "http://www.images.google.com/"; - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - - RegisterForNotifications(); - InitFilePaths(temp.path()); - - // Only use a single URL that is not in cache. That's sufficient for the test - // scenario, and makes things faster than needlessly cycling through all the - // other URLs. - - base::FilePath new_urls_file = temp.path().AppendASCII("urls"); - ASSERT_FALSE(base::PathExists(new_urls_file)); - - ASSERT_TRUE(file_util::WriteFile(new_urls_file, kCacheMissURL, - sizeof(kCacheMissURL))); - - InitPageCycler(new_urls_file, errors_file(), stats_file()); - page_cycler()->Run(); - - content::RunMessageLoop(); - ASSERT_TRUE(base::PathExists(errors_file())); - ASSERT_TRUE(base::PathExists(stats_file())); - - std::vector<std::string> errors = GetErrorsFromFile(); - ASSERT_EQ(1u, errors.size()); - - std::string expected_error; - expected_error.append("Failed to load the page at: ") - .append(kCacheMissURL) - .append(": The requested entry was not found in the cache."); - - ASSERT_FALSE(errors[0].compare(expected_error)); -} -#endif // !defined(OS_CHROMEOS) diff --git a/chrome/browser/page_cycler/page_cycler_unittest.cc b/chrome/browser/page_cycler/page_cycler_unittest.cc deleted file mode 100644 index c82a266..0000000 --- a/chrome/browser/page_cycler/page_cycler_unittest.cc +++ /dev/null @@ -1,352 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/file_util.h" -#include "base/path_service.h" -#include "base/prefs/testing_pref_service.h" -#include "base/run_loop.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/threading/sequenced_worker_pool.h" -#include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/page_cycler/page_cycler.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/url_constants.h" -#include "chrome/test/base/browser_with_test_window_test.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/test/test_browser_thread.h" -#include "net/base/net_errors.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -using ::testing::_; -using ::testing::Invoke; -using content::RenderViewHost; -using content::TestBrowserThread; -using content::WebContentsObserver; -using base::ContentsEqual; -using base::PathExists; - -namespace { -const int kFrameID = 1; -const bool kIsMainFrame = true; -const GURL kAboutURL = GURL(content::kAboutBlankURL); -} // namespace - -class MockPageCycler : public PageCycler { - public: - MockPageCycler(Browser* browser, base::FilePath urls_file, - base::FilePath errors_file) - : PageCycler(browser, urls_file) { - set_errors_file(errors_file); - } - - MockPageCycler(Browser* browser, - base::FilePath urls_file, - base::FilePath errors_file, - base::FilePath stats_file) - : PageCycler(browser, urls_file) { - set_stats_file(stats_file); - set_errors_file(errors_file); - } - - MOCK_METHOD4(DidFinishLoad, void(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host)); - MOCK_METHOD6(DidFailProvisionalLoad, void(int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - int error_code, - const string16& error_description, - RenderViewHost* render_view_host)); - MOCK_METHOD1(RenderProcessGone, void(base::TerminationStatus status)); - - void PageCyclerDidFailProvisionalLoad( - int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - int error_code, - const string16& error_description, - RenderViewHost* render_view_host) { - PageCycler::DidFailProvisionalLoad(frame_id, is_main_frame, - validated_url, - error_code, error_description, - render_view_host); - } - - void PageCyclerDidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host) { - PageCycler::DidFinishLoad( - frame_id, validated_url, is_main_frame, render_view_host); - } - - private: - // We need to override Finish() because the calls to exit the browser in a - // real PageCycler do not work in unittests (they interfere with later tests). - virtual void Finish() OVERRIDE { - BrowserList::RemoveObserver(this); - Release(); - } - - virtual ~MockPageCycler() {}\ - - DISALLOW_COPY_AND_ASSIGN(MockPageCycler); -}; - -class PageCyclerTest : public BrowserWithTestWindowTest { - public: - PageCyclerTest() { - } - - virtual ~PageCyclerTest() { - } - - virtual void SetUp() OVERRIDE { - PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); - test_data_dir_ = test_data_dir_.AppendASCII("page_cycler"); - - BrowserWithTestWindowTest::SetUp(); - AddTab(browser(), kAboutURL); - ASSERT_FALSE(browser()->tab_strip_model()->GetActiveWebContents() == NULL); - } - - void InitFilePaths(const base::FilePath& temp_path) { - errors_file_ = temp_path.AppendASCII("errors_file"); - stats_file_ = temp_path.AppendASCII("stats_file"); - - CHECK(!base::PathExists(errors_file_)); - CHECK(!base::PathExists(stats_file_)); - } - - void FailProvisionalLoad(int error_code, string16& error_description) { - FOR_EACH_OBSERVER( - WebContentsObserver, - observers_, - DidFailProvisionalLoad(kFrameID, kIsMainFrame, kAboutURL, error_code, - error_description, NULL)); - PumpLoop(); - } - - void FinishLoad() { - FOR_EACH_OBSERVER( - WebContentsObserver, - observers_, - DidFinishLoad(kFrameID, kAboutURL, kIsMainFrame, NULL)); - PumpLoop(); - } - - void RunPageCycler() { - page_cycler_->Run(); - PumpLoop(); - } - - void PumpLoop() { - content::BrowserThread::GetBlockingPool()->FlushForTesting(); - base::RunLoop().RunUntilIdle(); - } - - void CloseBrowser() { - DestroyBrowserAndProfile(); - PumpLoop(); - } - - MockPageCycler* page_cycler() { - return page_cycler_.get(); - } - - void set_page_cycler(MockPageCycler* page_cycler) { - page_cycler_ = page_cycler; - observers_.AddObserver(page_cycler); - } - - const std::vector<GURL>* urls_for_test() { - return page_cycler_->urls_for_test(); - } - - base::FilePath stats_file() { - return stats_file_; - } - - base::FilePath errors_file() { - return errors_file_; - } - - base::FilePath urls_file() { - return test_data_dir_.AppendASCII("about_url"); - } - - base::FilePath test_data_dir() { - return test_data_dir_; - } - - private: - ObserverList<WebContentsObserver> observers_; - scoped_refptr<MockPageCycler> page_cycler_; - base::FilePath test_data_dir_; - base::FilePath stats_file_; - base::FilePath errors_file_; - base::FilePath urls_file_; -}; - -TEST_F(PageCyclerTest, FailProvisionalLoads) { - const base::FilePath errors_expected_file = - test_data_dir().AppendASCII("errors_expected"); - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - InitFilePaths(temp.path()); - - ASSERT_TRUE(PathExists(errors_expected_file)); - ASSERT_TRUE(PathExists(urls_file())); - - set_page_cycler(new MockPageCycler(browser(), - urls_file(), - errors_file())); - RunPageCycler(); - - // Page cycler expects browser to automatically start loading the first page. - EXPECT_CALL(*page_cycler(), - DidFinishLoad(kFrameID, kAboutURL, kIsMainFrame, _)) - .WillOnce(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFinishLoad)); - FinishLoad(); - - // DNS server fail error message. - string16 error_string = - string16(ASCIIToUTF16(net::ErrorToString(net::ERR_DNS_SERVER_FAILED))); - EXPECT_CALL(*page_cycler(), - DidFailProvisionalLoad(kFrameID, kIsMainFrame, _, - net::ERR_DNS_SERVER_FAILED, error_string, - _)) - .WillOnce(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFailProvisionalLoad)); - FailProvisionalLoad(net::ERR_DNS_SERVER_FAILED, error_string); - - // DNS time-out error message. - error_string = string16( - ASCIIToUTF16(net::ErrorToString(net::ERR_DNS_TIMED_OUT))); - EXPECT_CALL(*page_cycler(), - DidFailProvisionalLoad(kFrameID, - kIsMainFrame, _, net::ERR_DNS_TIMED_OUT, - error_string, _)) - .WillOnce(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFailProvisionalLoad)); - - FailProvisionalLoad(net::ERR_DNS_TIMED_OUT, error_string); - - // DNS time-out error message. - error_string = string16( - ASCIIToUTF16(net::ErrorToString(net::ERR_INVALID_URL))); - EXPECT_CALL(*page_cycler(), - DidFailProvisionalLoad(kFrameID, kIsMainFrame, _, - net::ERR_INVALID_URL, error_string, _)) - .WillOnce(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFailProvisionalLoad)); - FailProvisionalLoad(net::ERR_INVALID_URL, error_string); - - PumpLoop(); - - std::string errors_output; - std::string errors_expected; - ASSERT_TRUE(base::ReadFileToString(errors_file(), &errors_output)); - ASSERT_TRUE(base::ReadFileToString(errors_expected_file, &errors_expected)); - ASSERT_EQ(errors_output, errors_expected); -} - -TEST_F(PageCyclerTest, StatsFile) { - const int kNumLoads = 4; - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - InitFilePaths(temp.path()); - - ASSERT_TRUE(PathExists(urls_file())); - - set_page_cycler(new MockPageCycler(browser(), urls_file(), - errors_file())); - page_cycler()->set_stats_file(stats_file()); - RunPageCycler(); - - for (int i = 0; i < kNumLoads; ++i) { - EXPECT_CALL(*page_cycler(), DidFinishLoad( - kFrameID, kAboutURL, kIsMainFrame, _)) - .WillOnce(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFinishLoad)); - FinishLoad(); - } - - PumpLoop(); - EXPECT_FALSE(PathExists(errors_file())); - ASSERT_TRUE(PathExists(stats_file())); -} - -TEST_F(PageCyclerTest, KillBrowserAndAbort) { - const base::FilePath errors_expected_file = - test_data_dir().AppendASCII("abort_expected"); - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - InitFilePaths(temp.path()); - - ASSERT_TRUE(PathExists(errors_expected_file)); - ASSERT_TRUE(PathExists(urls_file())); - - set_page_cycler(new MockPageCycler(browser(), - urls_file(), - errors_file())); - RunPageCycler(); - - EXPECT_CALL(*page_cycler(), - DidFinishLoad(kFrameID, kAboutURL, kIsMainFrame, _)) - .WillOnce(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFinishLoad)); - base::RunLoop().RunUntilIdle(); - - FinishLoad(); - - CloseBrowser(); - PumpLoop(); - - std::string errors_output; - std::string errors_expected; - ASSERT_TRUE(base::ReadFileToString(errors_file(), &errors_output)); - ASSERT_TRUE(base::ReadFileToString(errors_expected_file, &errors_expected)); - ASSERT_EQ(errors_output, errors_expected); -} - -TEST_F(PageCyclerTest, MultipleIterations) { - const int kNumLoads = 4; - - base::ScopedTempDir temp; - ASSERT_TRUE(temp.CreateUniqueTempDir()); - InitFilePaths(temp.path()); - - ASSERT_TRUE(PathExists(urls_file())); - - set_page_cycler(new MockPageCycler(browser(), - urls_file(), - errors_file())); - page_cycler()->set_stats_file(stats_file()); - RunPageCycler(); - - EXPECT_CALL(*page_cycler(), - DidFinishLoad(kFrameID, kAboutURL, kIsMainFrame, _)) - .WillRepeatedly(Invoke(page_cycler(), - &MockPageCycler::PageCyclerDidFinishLoad)); - - for (int i = 0; i < kNumLoads; ++i) - FinishLoad(); - - PumpLoop(); - EXPECT_FALSE(PathExists(errors_file())); - ASSERT_TRUE(PathExists(stats_file())); -} diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index 544c3dd..fd8149c 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -333,11 +333,8 @@ void ProfileImplIOData::InitializeInternal( IOThread* const io_thread = profile_params->io_thread; IOThread::Globals* const io_thread_globals = io_thread->globals(); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - // Only allow Record Mode if we are in a Debug build or where we are running - // a cycle, and the user has limited control. bool record_mode = command_line.HasSwitch(switches::kRecordMode) && - (chrome::kRecordModeEnabled || - command_line.HasSwitch(switches::kVisitURLs)); + chrome::kRecordModeEnabled; bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); network_delegate()->set_predictor(predictor_.get()); @@ -525,11 +522,8 @@ ProfileImplIOData::InitializeAppRequestContext( partition_descriptor.path.Append(chrome::kCacheDirname); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - // Only allow Record Mode if we are in a Debug build or where we are running - // a cycle, and the user has limited control. bool record_mode = command_line.HasSwitch(switches::kRecordMode) && - (chrome::kRecordModeEnabled || - command_line.HasSwitch(switches::kVisitURLs)); + chrome::kRecordModeEnabled; bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); // Use a separate HTTP disk cache for isolated apps. diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 338d59b..80f6273 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1270,8 +1270,6 @@ 'browser/omnibox/omnibox_field_trial.h', 'browser/omnibox/omnibox_log.cc', 'browser/omnibox/omnibox_log.h', - 'browser/page_cycler/page_cycler.cc', - 'browser/page_cycler/page_cycler.h', 'browser/parsers/metadata_parser.cc', 'browser/parsers/metadata_parser.h', 'browser/parsers/metadata_parser_factory.h', @@ -2478,15 +2476,14 @@ 'browser/webdata/web_data_service_win.cc', 'browser/webdata/web_intents_table.cc', 'browser/webdata/web_intents_table.h', - # These files are needed by page_cycler.cc and performance_monitor.cc. - # This dependency should be removed: crbug.com/280157, crbug.com/279660 + + # These files are needed by performance_monitor.cc and this dependency + # should be removed (crbug.com/279660) 'test/base/test_switches.cc', 'test/base/test_switches.h', 'test/base/chrome_process_util.cc', 'test/base/chrome_process_util.h', 'test/base/chrome_process_util_mac.cc', - 'test/perf/perf_test.cc', - 'test/perf/perf_test.h', # These files are generated by GRIT. '<(grit_out_dir)/grit/component_extension_resources_map.cc', @@ -3063,8 +3060,6 @@ 'browser/download/download_crx_util.cc', 'browser/net/gaia/gaia_oauth_fetcher.cc', - 'browser/page_cycler/page_cycler.cc', - 'browser/page_cycler/page_cycler.h', 'browser/policy/async_policy_loader.cc', 'browser/policy/async_policy_loader.h', 'browser/policy/async_policy_provider.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 8ad11f7..fe7a35c 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1131,6 +1131,7 @@ 'chrome_resources.gyp:packed_resources', 'common/extensions/api/api.gyp:api', 'renderer', + 'test/perf/perf_test.gyp:*', 'test_support_common', 'test_support_unit', '../base/base.gyp:base', @@ -1496,7 +1497,6 @@ 'browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc', 'browser/notifications/sync_notifier/sync_notifier_test_utils.cc', 'browser/notifications/sync_notifier/sync_notifier_test_utils.h', - 'browser/page_cycler/page_cycler_browsertest.cc', 'browser/password_manager/password_manager_browsertest.cc', 'browser/performance_monitor/performance_monitor_browsertest.cc', 'browser/policy/cloud/cloud_policy_browsertest.cc', @@ -2026,8 +2026,7 @@ ], # TODO(mark): We really want this for all non-static library # targets, but when we tried to pull it up to the common.gypi - # level, it broke other things like the ui, startup, and - # page_cycler tests. *shrug* + # level, it broke other things like the ui and startup tests. *shrug* 'xcode_settings': { 'OTHER_LDFLAGS': [ '-Wl,-ObjC', @@ -2149,6 +2148,7 @@ 'chrome_resources.gyp:packed_extra_resources', 'chrome_resources.gyp:packed_resources', 'renderer', + 'test/perf/perf_test.gyp:*', 'test_support_common', '../base/base.gyp:base', '../base/base.gyp:base_i18n', @@ -2159,6 +2159,7 @@ '../sync/sync.gyp:sync', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', + '../testing/perf/perf_test.gyp:*', '../third_party/cld/cld.gyp:cld', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', @@ -2283,8 +2284,7 @@ ], # TODO(mark): We really want this for all non-static library # targets, but when we tried to pull it up to the common.gypi - # level, it broke other things like the ui, startup, and - # page_cycler tests. *shrug* + # level, it broke other things like the ui and startup tests. *shrug* 'xcode_settings': { 'OTHER_LDFLAGS': [ '-Wl,-ObjC', @@ -2382,6 +2382,7 @@ 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', 'debugger', + 'test/perf/perf_test.gyp:*', 'test_support_common', 'test_support_ui', '../base/base.gyp:base', @@ -2659,6 +2660,7 @@ 'browser', 'chrome', 'common/extensions/api/api.gyp:api', + 'test/perf/perf_test.gyp:*', 'test_support_common', '../skia/skia.gyp:skia', '../sync/sync.gyp:sync', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index d7e4e84..b9b14be 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1026,7 +1026,6 @@ 'browser/notifications/sync_notifier/sync_notifier_test_utils.cc', 'browser/notifications/sync_notifier/sync_notifier_test_utils.h', 'browser/omnibox/omnibox_field_trial_unittest.cc', - 'browser/page_cycler/page_cycler_unittest.cc', 'browser/parsers/metadata_parser_filebase_unittest.cc', 'browser/password_manager/login_database_unittest.cc', 'browser/password_manager/native_backend_gnome_x_unittest.cc', @@ -2351,7 +2350,7 @@ ], # TODO(mark): We really want this for all non-static library targets, # but when we tried to pull it up to the common.gypi level, it broke - # other things like the ui, startup, and page_cycler tests. *shrug* + # other things like the ui and startup tests. *shrug* 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']}, }], ['OS!="mac" and OS!="ios"', { @@ -2472,7 +2471,6 @@ 'browser/download/download_shelf_unittest.cc', 'browser/storage_monitor/media_storage_util_unittest.cc', 'browser/net/gaia/gaia_oauth_fetcher_unittest.cc', - 'browser/page_cycler/page_cycler_unittest.cc', 'browser/policy/async_policy_provider_unittest.cc', 'browser/policy/cloud/cloud_external_data_manager_base_unittest.cc', 'browser/policy/cloud/cloud_external_data_store_unittest.cc', @@ -2680,7 +2678,7 @@ ['OS=="mac"', { # TODO(mark): We really want this for all non-static library targets, # but when we tried to pull it up to the common.gypi level, it broke - # other things like the ui, startup, and page_cycler tests. *shrug* + # other things like the ui and startup tests. *shrug* 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']}, }], ['OS=="win"', { diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 76b1b22..bf42662 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1455,9 +1455,6 @@ const char kVariationsServerURL[] = "variations-server-url"; // Prints version information and quits. const char kVersion[] = "version"; -// Cycle through a series of URLs listed in the specified file. -const char kVisitURLs[] = "visit-urls"; - // Adds the given extension ID to all the permission whitelists. const char kWhitelistedExtensionID[] = "whitelisted-extension-id"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index e585142..4dc96d3 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -390,7 +390,6 @@ extern const char kUserDataDir[]; extern const char kValidateCrx[]; extern const char kVariationsServerURL[]; extern const char kVersion[]; -extern const char kVisitURLs[]; extern const char kWhitelistedExtensionID[]; extern const char kWindowPosition[]; extern const char kWindowSize[]; diff --git a/chrome/test/perf/perf_test.gyp b/chrome/test/perf/perf_test.gyp new file mode 100644 index 0000000..b1271c1 --- /dev/null +++ b/chrome/test/perf/perf_test.gyp @@ -0,0 +1,18 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'chrome_perf_test', + 'type': 'static_library', + 'sources': [ + 'perf_test.cc', + ], + 'dependencies': [ + '../../../base/base.gyp:base', + '../../../testing/perf/perf_test.gyp:*', + ], + }, + ], +} diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp index 61ece92..d401ce2 100644 --- a/chrome_frame/chrome_frame.gyp +++ b/chrome_frame/chrome_frame.gyp @@ -335,10 +335,10 @@ '../chrome/chrome.gyp:test_support_common', '../chrome/chrome.gyp:test_support_ui', '../chrome/chrome.gyp:utility', + '../chrome/test/perf/perf_test.gyp:*', '../content/content.gyp:content_gpu', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', - '../testing/perf/perf_test.gyp:*', '../third_party/libxml/libxml.gyp:libxml', '../third_party/libxslt/libxslt.gyp:libxslt', '../url/url.gyp:url_lib', |