diff options
24 files changed, 115 insertions, 143 deletions
diff --git a/chrome/test/live_sync/live_autofill_sync_test.h b/chrome/test/live_sync/live_autofill_sync_test.h index f591488..32cb2d3 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.h +++ b/chrome/test/live_sync/live_autofill_sync_test.h @@ -271,20 +271,20 @@ class LiveAutofillSyncTest : public LiveSyncTest { for (size_t i = 0; i < profiles.size(); ++i) { const AutoFillProfile* p = profiles[i]; if (!expected_profiles_map.count(p->Label())) { - LOG(INFO) << "Label " << p->Label() << " not in expected"; + VLOG(1) << "Label " << p->Label() << " not in expected"; return false; } AutoFillProfile* expected_profile = &expected_profiles_map[p->Label()]; expected_profile->set_unique_id(p->unique_id()); if (*expected_profile != *p) { - LOG(INFO) << "Profile mismatch"; + VLOG(1) << "Profile mismatch"; return false; } expected_profiles_map.erase(p->Label()); } if (expected_profiles_map.size()) { - LOG(INFO) << "Labels in expected but not supplied"; + VLOG(1) << "Labels in expected but not supplied"; return false; } diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc index 6fd16cb..eca363e 100644 --- a/chrome/test/live_sync/live_sync_test.cc +++ b/chrome/test/live_sync/live_sync_test.cc @@ -281,8 +281,8 @@ void LiveSyncTest::SetUpTestServerIfRequired() { LOG(FATAL) << "Failed to set up local python test server"; } else if (!cl->HasSwitch(switches::kSyncServiceURL) && cl->HasSwitch(switches::kSyncServerCommandLine)) { - LOG(FATAL) - << "Sync server command line must be accompanied by sync service URL."; + LOG(FATAL) << "Sync server command line must be accompanied by sync " + "service URL."; } } @@ -295,7 +295,7 @@ bool LiveSyncTest::SetUpLocalPythonTestServer() { test_server()->host_port_pair().host().c_str(), test_server()->host_port_pair().port()); cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url); - LOG(INFO) << "Started local python test server at " << sync_service_url; + VLOG(1) << "Started local python test server at " << sync_service_url; // TODO(akalin): Set the kSyncNotificationHost switch here once a local python // notification server is implemented. @@ -321,8 +321,8 @@ bool LiveSyncTest::SetUpLocalTestServer() { const int kMaxWaitTime = TestTimeouts::live_operation_timeout_ms(); const int kNumIntervals = 15; if (WaitForTestServerToStart(kMaxWaitTime, kNumIntervals)) { - LOG(INFO) << "Started local test server at " - << cl->GetSwitchValueASCII(switches::kSyncServiceURL) << "."; + VLOG(1) << "Started local test server at " + << cl->GetSwitchValueASCII(switches::kSyncServiceURL) << "."; return true; } else { LOG(ERROR) << "Could not start local test server at " diff --git a/chrome/test/live_sync/profile_sync_service_test_harness.cc b/chrome/test/live_sync/profile_sync_service_test_harness.cc index 5d037f6..a903fa7 100644 --- a/chrome/test/live_sync/profile_sync_service_test_harness.cc +++ b/chrome/test/live_sync/profile_sync_service_test_harness.cc @@ -322,7 +322,7 @@ bool ProfileSyncServiceTestHarness::AwaitGroupSyncCycleCompletion( // static bool ProfileSyncServiceTestHarness::AwaitQuiescence( std::vector<ProfileSyncServiceTestHarness*>& clients) { - LOG(INFO) << "AwaitQuiescence."; + VLOG(1) << "AwaitQuiescence."; bool return_value = true; for (std::vector<ProfileSyncServiceTestHarness*>::iterator it = clients.begin(); it != clients.end(); ++it) { @@ -419,13 +419,11 @@ void ProfileSyncServiceTestHarness::EnableSyncForDatatype( service()->OnUserChoseDatatypes(false, synced_datatypes); wait_state_ = WAITING_FOR_SYNC_TO_FINISH; AwaitSyncCycleCompletion("Waiting for datatype configuration."); - LOG(INFO) << "EnableSyncForDatatype(): Enabled sync for datatype " - << syncable::ModelTypeToString(datatype) - << " on Client " << id_ << "."; + VLOG(1) << "EnableSyncForDatatype(): Enabled sync for datatype " + << syncable::ModelTypeToString(datatype) << " on Client " << id_; } else { - LOG(INFO) << "EnableSyncForDatatype(): Sync already enabled for datatype " - << syncable::ModelTypeToString(datatype) - << " on Client " << id_ << "."; + VLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " + << syncable::ModelTypeToString(datatype) << " on Client " << id_; } } } @@ -442,13 +440,11 @@ void ProfileSyncServiceTestHarness::DisableSyncForDatatype( synced_datatypes.erase(it); service()->OnUserChoseDatatypes(false, synced_datatypes); AwaitSyncCycleCompletion("Waiting for datatype configuration."); - LOG(INFO) << "DisableSyncForDatatype(): Disabled sync for datatype " - << syncable::ModelTypeToString(datatype) - << " on Client " << id_ << "."; + VLOG(1) << "DisableSyncForDatatype(): Disabled sync for datatype " + << syncable::ModelTypeToString(datatype) << " on Client " << id_; } else { - LOG(INFO) << "DisableSyncForDatatype(): Sync already disabled for datatype " - << syncable::ModelTypeToString(datatype) - << " on Client " << id_ << "."; + VLOG(1) << "DisableSyncForDatatype(): Sync already disabled for datatype " + << syncable::ModelTypeToString(datatype) << " on Client " << id_; } } @@ -469,8 +465,8 @@ void ProfileSyncServiceTestHarness::EnableSyncForAllDatatypes() { service()->OnUserChoseDatatypes(true, synced_datatypes); wait_state_ = WAITING_FOR_SYNC_TO_FINISH; AwaitSyncCycleCompletion("Waiting for datatype configuration."); - LOG(INFO) << "EnableSyncForAllDatatypes(): Enabled sync for all datatypes" - << " on Client " << id_ << "."; + VLOG(1) << "EnableSyncForAllDatatypes(): Enabled sync for all datatypes on " + "Client " << id_; } } @@ -480,8 +476,8 @@ void ProfileSyncServiceTestHarness::DisableSyncForAllDatatypes() { << "EnableSyncForAllDatatypes(): service() is null."; service()->DisableForUser(); wait_state_ = SYNC_DISABLED; - LOG(INFO) << "DisableSyncForAllDatatypes(): Disabled sync for all datatypes" - << " on Client " << id_ << "."; + VLOG(1) << "DisableSyncForAllDatatypes(): Disabled sync for all datatypes on " + "Client " << id_; } int64 ProfileSyncServiceTestHarness::GetUpdatedTimestamp() { @@ -495,16 +491,17 @@ int64 ProfileSyncServiceTestHarness::GetUpdatedTimestamp() { void ProfileSyncServiceTestHarness::LogClientInfo(std::string message) { const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); if (snap) { - LOG(INFO) << "Client " << id_ << ": " << message << ": " - << "max_local_timestamp: " << snap->max_local_timestamp - << ", has_more_to_sync: " << snap->has_more_to_sync - << ", unsynced_count: " << snap->unsynced_count - << ", has_unsynced_items: " << service()->backend()->HasUnsyncedItems() - << ", notifications_enabled: " << GetStatus().notifications_enabled - << ", service_is_pushing_changes: " << ServiceIsPushingChanges() - << "."; + VLOG(1) << "Client " << id_ << ": " << message + << ": max_local_timestamp: " << snap->max_local_timestamp + << ", has_more_to_sync: " << snap->has_more_to_sync + << ", unsynced_count: " << snap->unsynced_count + << ", has_unsynced_items: " + << service()->backend()->HasUnsyncedItems() + << ", notifications_enabled: " + << GetStatus().notifications_enabled + << ", service_is_pushing_changes: " << ServiceIsPushingChanges(); } else { - LOG(INFO) << "Client " << id_ << ": " << message << ": " - << "Sync session snapshot not available."; + VLOG(1) << "Client " << id_ << ": " << message + << ": Sync session snapshot not available."; } } diff --git a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc index e857d25..8f337a2 100644 --- a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc @@ -338,7 +338,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } } } - LOG(INFO) << "Adding several bookmarks under other bookmarks"; + VLOG(1) << "Adding several bookmarks under other bookmarks"; for (int index = 0; index < 10; index++) { wstring title(L"Other - TestBookmark"); title.append(IntToWStringHack(index)); diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 6bb9798..cbdd620 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -244,7 +244,7 @@ class MemoryTest : public UIPerfTest { // sets temp_dir_ to the containing temporary directory, // and sets cleanup_temp_dir_on_exit_ to true. bool SetupTempDirectory(const FilePath& src_dir) { - LOG(INFO) << "Setting up temp directory in " << src_dir.value(); + VLOG(1) << "Setting up temp directory in " << src_dir.value(); // We create a copy of the test dir and use it so that each // run of this test starts with the same data. Running this // test has the side effect that it will change the profile. @@ -262,7 +262,7 @@ class MemoryTest : public UIPerfTest { // directory as its base name, so point user_data_dir_ there. user_data_dir_ = temp_dir_.Append(src_dir.BaseName()); cleanup_temp_dir_on_exit_ = true; - LOG(INFO) << "Finished temp directory setup."; + VLOG(1) << "Finished temp directory setup."; return true; } diff --git a/chrome/test/mini_installer_test/mini_installer_test_util.cc b/chrome/test/mini_installer_test/mini_installer_test_util.cc index 697f6d0..1fb0227 100644 --- a/chrome/test/mini_installer_test/mini_installer_test_util.cc +++ b/chrome/test/mini_installer_test/mini_installer_test_util.cc @@ -81,7 +81,7 @@ bool MiniInstallerTestUtil::GetCommandForTagging(std::wstring *return_command) { return_command->append(mini_installer_constants::kStandaloneInstaller); return_command->append(L" "); return_command->append(mini_installer_constants::kChromeApplyTagParameters); - LOG(INFO) << "Command to run Apply tag: " << return_command->c_str(); + VLOG(1) << "Command to run Apply tag: " << return_command->c_str(); return true; } @@ -89,7 +89,7 @@ std::wstring MiniInstallerTestUtil::GetFilePath(const wchar_t* exe_name) { FilePath installer_path; PathService::Get(base::DIR_EXE, &installer_path); installer_path = installer_path.Append(exe_name); - LOG(INFO) << "Chrome exe path: " << installer_path.value().c_str(); + VLOG(1) << "Chrome exe path: " << installer_path.value().c_str(); return installer_path.ToWStringHack(); } @@ -136,7 +136,7 @@ bool MiniInstallerTestUtil::GetLatestFile(const wchar_t* file_name, WIN32_FIND_DATA find_file_data; HANDLE file_handle = FindFirstFile(file_name, &find_file_data); if (file_handle == INVALID_HANDLE_VALUE) { - LOG(INFO) << "Handle is invalid."; + VLOG(1) << "Handle is invalid."; return false; } BOOL ret = TRUE; @@ -248,7 +248,7 @@ bool MiniInstallerTestUtil::GetStandaloneVersion( file_name.replace(pos, 1, L"."); file_name = L"3.0." + file_name; return_file_name->assign(file_name.c_str()); - LOG(INFO) << "Standalone installer version: " << file_name.c_str(); + VLOG(1) << "Standalone installer version: " << file_name.c_str(); return true; } @@ -288,14 +288,14 @@ bool MiniInstallerTestUtil::VerifyProcessClose( const wchar_t* process_name) { int timer = 0; if (base::GetProcessCount(process_name, NULL) > 0) { - LOG(INFO) << "Waiting for this process to end: " << process_name; + VLOG(1) << "Waiting for this process to end: " << process_name; while ((base::GetProcessCount(process_name, NULL) > 0) && (timer < TestTimeouts::large_test_timeout_ms())) { PlatformThread::Sleep(200); timer = timer + 200; } } else { - if (base::GetProcessCount(process_name, NULL) != 0) + if (base::GetProcessCount(process_name, NULL) != 0) return false; } return true; diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index f3d06fa4..1674869 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -148,7 +148,7 @@ void PopulateBufferCache(const FilePath& test_dir) { ++loaded; } } - LOG(INFO) << "Buffer cache should be primed with " << loaded << " files."; + VLOG(1) << "Buffer cache should be primed with " << loaded << " files."; } class PageCyclerTest : public UIPerfTest { diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index 160af12..cc93c45 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -209,7 +209,7 @@ class PluginInstallerDownloadTest } ~UploadRequestContext() { - DLOG(INFO) << __FUNCTION__; + DVLOG(1) << __FUNCTION__; delete http_transaction_factory_; delete http_auth_handler_factory_; } diff --git a/chrome/test/startup/shutdown_test.cc b/chrome/test/startup/shutdown_test.cc index 0d0f609..d1c3c8a 100644 --- a/chrome/test/startup/shutdown_test.cc +++ b/chrome/test/startup/shutdown_test.cc @@ -75,13 +75,12 @@ class ShutdownTest : public UIPerfTest { if (env->GetVar(env_vars::kStartupTestsNumCycles, &numCyclesEnv) && base::StringToInt(numCyclesEnv, &numCycles)) { if (numCycles <= kNumCyclesMax) { - LOG(INFO) << env_vars::kStartupTestsNumCycles - << " set in environment, so setting numCycles to " - << numCycles; + VLOG(1) << env_vars::kStartupTestsNumCycles + << " set in environment, so setting numCycles to " << numCycles; } else { - LOG(INFO) << env_vars::kStartupTestsNumCycles - << " is higher than the max, setting numCycles to " - << kNumCyclesMax; + VLOG(1) << env_vars::kStartupTestsNumCycles + << " is higher than the max, setting numCycles to " + << kNumCyclesMax; numCycles = kNumCyclesMax; } } diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index 5fa9380..b94316a 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -110,13 +110,12 @@ class StartupTest : public UIPerfTest { if (env->GetVar(env_vars::kStartupTestsNumCycles, &numCyclesEnv) && base::StringToInt(numCyclesEnv, &numCycles)) { if (numCycles <= kNumCyclesMax) { - LOG(INFO) << env_vars::kStartupTestsNumCycles - << " set in environment, so setting numCycles to " - << numCycles; + VLOG(1) << env_vars::kStartupTestsNumCycles + << " set in environment, so setting numCycles to " << numCycles; } else { - LOG(INFO) << env_vars::kStartupTestsNumCycles - << " is higher than the max, setting numCycles to " - << kNumCyclesMax; + VLOG(1) << env_vars::kStartupTestsNumCycles + << " is higher than the max, setting numCycles to " + << kNumCyclesMax; numCycles = kNumCyclesMax; } } diff --git a/chrome/test/test_launcher/test_runner.cc b/chrome/test/test_launcher/test_runner.cc index de448a36..7b3a3b7 100644 --- a/chrome/test/test_launcher/test_runner.cc +++ b/chrome/test/test_launcher/test_runner.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -74,14 +74,13 @@ ResultsPrinter::ResultsPrinter(const CommandLine& command_line) : out_(NULL) { FilePath dir_name = path.DirName(); if (!file_util::DirectoryExists(dir_name)) { LOG(WARNING) << "The output directory does not exist. " - << "Creating the directory: " << dir_name.value() << std::endl; + << "Creating the directory: " << dir_name.value(); // Create the directory if necessary (because the gtest does the same). file_util::CreateDirectory(dir_name); } out_ = file_util::OpenFile(path, "w"); if (!out_) { - LOG(ERROR) << "Cannot open output file: " - << path.value() << "." << std::endl; + LOG(ERROR) << "Cannot open output file: " << path.value() << "."; return; } fprintf(out_, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); diff --git a/chrome/test/ui/ui_layout_test.cc b/chrome/test/ui/ui_layout_test.cc index c80b992..550fa48 100644 --- a/chrome/test/ui/ui_layout_test.cc +++ b/chrome/test/ui/ui_layout_test.cc @@ -255,8 +255,8 @@ void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name, // Compares the results. EXPECT_STREQ(expected_result_value.c_str(), value.c_str()); - LOG(INFO) << "Test " << test_case_file_name << " took " - << (base::Time::Now() - start).InMilliseconds() << "ms"; + VLOG(1) << "Test " << test_case_file_name + << " took " << (base::Time::Now() - start).InMilliseconds() << "ms"; } bool UILayoutTest::ReadExpectedResult(const FilePath& result_dir_path, diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 63e9415..958eb62 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -174,8 +174,7 @@ void UITestBase::TearDown() { // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms. void UITestBase::set_command_execution_timeout_ms(int timeout) { server_->set_command_execution_timeout_ms(timeout); - LOG(INFO) << "Automation command execution timeout set to " - << timeout << " milli secs."; + VLOG(1) << "Automation command execution timeout set to " << timeout << " ms"; } AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) { @@ -772,8 +771,8 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments, const char* browser_wrapper = getenv("BROWSER_WRAPPER"); if (browser_wrapper) { command_line.PrependWrapper(browser_wrapper); - LOG(INFO) << "BROWSER_WRAPPER was set, prefixing command_line with " - << browser_wrapper; + VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " + << browser_wrapper; } bool started = base::LaunchApp(command_line.argv(), diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index 8709397..a49f2aa 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -243,7 +243,7 @@ class FindInPageNotificationObserver : public NotificationObserver { number_of_matches_ = find_details->number_of_matches(); MessageLoopForUI::current()->Quit(); } else { - DLOG(INFO) << "Ignoring, since we only care about the final message"; + DVLOG(1) << "Ignoring, since we only care about the final message"; } } } else { diff --git a/chrome/test/unit/chrome_test_suite.cc b/chrome/test/unit/chrome_test_suite.cc index 7c52254..16d7239 100644 --- a/chrome/test/unit/chrome_test_suite.cc +++ b/chrome/test/unit/chrome_test_suite.cc @@ -67,8 +67,8 @@ int LocalHostResolverProc::Resolve(const std::string& host, // If you really need to make an external DNS query, use // net::RuleBasedHostResolverProc and its AllowDirectLookup method. if (!local) { - DLOG(INFO) << "To avoid external dependencies, simulating failure for " - << "external DNS lookup of " << host; + DVLOG(1) << "To avoid external dependencies, simulating failure for " + "external DNS lookup of " << host; return net::ERR_NOT_IMPLEMENTED; } diff --git a/chrome/test/webdriver/commands/create_session.cc b/chrome/test/webdriver/commands/create_session.cc index 42dd722..6903efb 100644 --- a/chrome/test/webdriver/commands/create_session.cc +++ b/chrome/test/webdriver/commands/create_session.cc @@ -24,7 +24,7 @@ void CreateSession::ExecutePost(Response* const response) { return; } - LOG(INFO) << "Created session " << session_id; + VLOG(1) << "Created session " << session_id; std::ostringstream stream; stream << "http://" << session_manager->GetIPAddress() << "/session/" << session_id; diff --git a/chrome/test/webdriver/commands/webdriver_command.cc b/chrome/test/webdriver/commands/webdriver_command.cc index 68a42f5..d7e9ab0 100644 --- a/chrome/test/webdriver/commands/webdriver_command.cc +++ b/chrome/test/webdriver/commands/webdriver_command.cc @@ -50,7 +50,7 @@ bool WebDriverCommand::Init(Response* const response) { return false; } - LOG(INFO) << "Fetching session: " << session_id; + VLOG(1) << "Fetching session: " << session_id; session_ = Singleton<SessionManager>::get()->GetSession(session_id); if (session_ == NULL) { response->set_value(Value::CreateStringValue( diff --git a/chrome/test/webdriver/dispatch.cc b/chrome/test/webdriver/dispatch.cc index 20ddfe3..a24b43e 100644 --- a/chrome/test/webdriver/dispatch.cc +++ b/chrome/test/webdriver/dispatch.cc @@ -26,10 +26,9 @@ void SendHttpOk(struct mg_connection* const connection, << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n" << "Accept-Ranges: bytes\r\n" << "Connection: close\r\n\r\n"; - if (strcmp(request_info->request_method, "HEAD") != 0) { + if (strcmp(request_info->request_method, "HEAD") != 0) out << json << "\r\n"; - } - LOG(INFO) << out.str(); + VLOG(1) << out.str(); mg_printf(connection, "%s", out.str().c_str()); } @@ -48,7 +47,7 @@ void SendHttpSeeOther(struct mg_connection* const connection, << "Location: " << location << "\r\n" << "Content-Type: text/html\r\n" << "Content-Length: 0\r\n\r\n"; - LOG(INFO) << out.str(); + VLOG(1) << out.str(); mg_printf(connection, "%s", out.str().c_str()); } @@ -63,10 +62,9 @@ void SendHttpBadRequest(struct mg_connection* const connection, << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n" << "Accept-Ranges: bytes\r\n" << "Connection: close\r\n\r\n"; - if (strcmp(request_info->request_method, "HEAD") != 0) { + if (strcmp(request_info->request_method, "HEAD") != 0) out << json << "\r\n"; - } - LOG(INFO) << out.str(); + VLOG(1) << out.str(); mg_printf(connection, "%s", out.str().c_str()); } @@ -81,10 +79,9 @@ void SendHttpNotFound(struct mg_connection* const connection, << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n" << "Accept-Ranges: bytes\r\n" << "Connection: close\r\n\r\n"; - if (strcmp(request_info->request_method, "HEAD") != 0) { + if (strcmp(request_info->request_method, "HEAD") != 0) out << json << "\r\n"; - } - LOG(INFO) << out.str(); + VLOG(1) << out.str(); mg_printf(connection, "%s", out.str().c_str()); } @@ -108,7 +105,7 @@ void SendHttpMethodNotAllowed(struct mg_connection* const connection, << "Content-Type: text/html\r\n" << "Content-Length: 0\r\n" << "Allow: " << JoinString(allowed_methods, ',') << "\r\n\r\n"; - LOG(INFO) << out.str(); + VLOG(1) << out.str(); mg_printf(connection, "%s", out.str().c_str()); } @@ -123,10 +120,9 @@ void SendHttpInternalError(struct mg_connection* const connection, << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n" << "Accept-Ranges: bytes\r\n" << "Connection: close\r\n\r\n"; - if (strcmp(request_info->request_method, "HEAD") != 0) { + if (strcmp(request_info->request_method, "HEAD") != 0) out << json << "\r\n"; - } - LOG(INFO) << out.str(); + VLOG(1) << out.str(); mg_printf(connection, "%s", out.str().c_str()); } @@ -136,29 +132,24 @@ void SendHttpInternalError(struct mg_connection* const connection, void DispatchCommand(Command* const command, const std::string& method, Response* response) { if (command->DoesPost() && method == "POST") { - if (command->Init(response)) { + if (command->Init(response)) command->ExecutePost(response); - } } else if (command->DoesGet() && method == "GET") { - if (command->Init(response)) { + if (command->Init(response)) command->ExecuteGet(response); - } } else if (command->DoesDelete() && method == "DELETE") { - if (command->Init(response)) { + if (command->Init(response)) command->ExecuteDelete(response); - } } else { ListValue* methods = new ListValue; - if (command->DoesPost()) { + if (command->DoesPost()) methods->Append(Value::CreateStringValue("POST")); - } if (command->DoesGet()) { methods->Append(Value::CreateStringValue("GET")); methods->Append(Value::CreateStringValue("HEAD")); } - if (command->DoesDelete()) { + if (command->DoesDelete()) methods->Append(Value::CreateStringValue("DELETE")); - } response->set_status(kMethodNotAllowed); response->set_value(methods); // Assumes ownership. } diff --git a/chrome/test/webdriver/dispatch.h b/chrome/test/webdriver/dispatch.h index 61f877b..5add729 100644 --- a/chrome/test/webdriver/dispatch.h +++ b/chrome/test/webdriver/dispatch.h @@ -54,7 +54,7 @@ void Dispatch(struct mg_connection* connection, DictionaryValue* parameters = NULL; if ((method == "POST" || method == "PUT") && request_info->post_data_len > 0) { - LOG(INFO) << "...parsing request body"; + VLOG(1) << "...parsing request body"; std::string json(request_info->post_data, request_info->post_data_len); std::string error; if (!ParseJSONDictionary(json, ¶meters, &error)) { @@ -66,9 +66,8 @@ void Dispatch(struct mg_connection* connection, } } - LOG(INFO) << "Dispatching " << method << " " << uri - << std::string(request_info->post_data, - request_info->post_data_len) << std::endl; + VLOG(1) << "Dispatching " << method << " " << uri + << std::string(request_info->post_data, request_info->post_data_len); scoped_ptr<CommandType> ptr(new CommandType(path_segments, parameters)); DispatchCommand(ptr.get(), method, &response); SendResponse(connection, request_info, response); diff --git a/chrome/test/webdriver/keymap.cc b/chrome/test/webdriver/keymap.cc index 57bc171..1ab0a31 100644 --- a/chrome/test/webdriver/keymap.cc +++ b/chrome/test/webdriver/keymap.cc @@ -154,7 +154,7 @@ bool KeyMap::Press(const scoped_refptr<WindowProxy>& window, modifiers = modifiers | views::Event::EF_ALT_DOWN; } if (command_) { - LOG(INFO) << "Pressing command key on linux!!"; + VLOG(1) << "Pressing command key on linux!!"; modifiers = modifiers | views::Event::EF_COMMAND_DOWN; } diff --git a/chrome/test/webdriver/server.cc b/chrome/test/webdriver/server.cc index 901a379..57d031f 100644 --- a/chrome/test/webdriver/server.cc +++ b/chrome/test/webdriver/server.cc @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { port = cmd_line.GetSwitchValueASCII(std::string("port")); } - LOG(INFO) << "Using port: " << port; + VLOG(1) << "Using port: " << port; webdriver::SessionManager* session = Singleton<webdriver::SessionManager>::get(); session->SetIPAddress(port); @@ -115,9 +115,8 @@ int main(int argc, char *argv[]) { std::cout << "Starting server" << std::endl; // The default behavior is to run this service forever. - while (true) { + while (true) PlatformThread::Sleep(3600); - } // We should not reach here since the service should never quit. // TODO(jmikhail): register a listener for SIGTERM and break the diff --git a/chrome/test/webdriver/session.cc b/chrome/test/webdriver/session.cc index 84d2cbd..218c7f1 100644 --- a/chrome/test/webdriver/session.cc +++ b/chrome/test/webdriver/session.cc @@ -69,8 +69,8 @@ bool Session::Init() { // Create a temp directory for the new profile. if (!CreateTemporaryProfileDirectory()) { LOG(ERROR) << "Could not make a temp profile directory, " - << tmp_profile_dir() << std::endl - << "Need to quit, the issue must be fixed"; + << tmp_profile_dir() + << "\nNeed to quit, the issue must be fixed"; exit(-1); } @@ -163,7 +163,7 @@ bool Session::CreateTemporaryProfileDirectory() { return false; } #endif - LOG(INFO) << "Using temporary profile directory: " << tmp_profile_dir_; + VLOG(1) << "Using temporary profile directory: " << tmp_profile_dir_; return true; } @@ -174,10 +174,8 @@ void Session::Terminate() { #elif OS_WIN FilePath del_dir = FilePath(ASCIIToWide(tmp_profile_dir())); #endif - if (file_util::PathExists(del_dir) && !file_util::Delete(del_dir, true)) { - LOG(ERROR) << "Could not clean up temp directory: " - << tmp_profile_dir() << std::endl; - } + if (file_util::PathExists(del_dir) && !file_util::Delete(del_dir, true)) + LOG(ERROR) << "Could not clean up temp directory: " << tmp_profile_dir(); } ErrorCode Session::ExecuteScript(const std::wstring& script, @@ -188,21 +186,17 @@ ErrorCode Session::ExecuteScript(const std::wstring& script, /*pretty_print=*/false, &args_as_json); - std::wstring jscript = L"window.domAutomationController.send("; - jscript.append(L"(function(){") - // Every injected script is fed through the executeScript atom. This atom - // will catch any errors that are thrown and convert them to the - // appropriate JSON structure. - .append(build_atom(EXECUTE_SCRIPT, sizeof EXECUTE_SCRIPT)) - .append(L"var result = executeScript(function(){") - .append(script) - .append(L"},") - .append(ASCIIToWide(args_as_json)) - .append(L");return JSON.stringify(result);})());"); + std::wstring jscript = L"window.domAutomationController.send((function(){" + + // Every injected script is fed through the executeScript atom. This atom + // will catch any errors that are thrown and convert them to the + // appropriate JSON structure. + build_atom(EXECUTE_SCRIPT, sizeof EXECUTE_SCRIPT) + + L"var result = executeScript(function(){" + script + L"}," + + ASCIIToWide(args_as_json) + L");return JSON.stringify(result);})());"; // Should we also log the script that's being executed? It could be several KB // in size and will add lots of noise to the logs. - LOG(INFO) << "Executing script in frame: " << current_frame_xpath_; + VLOG(1) << "Executing script in frame: " << current_frame_xpath_; std::wstring result; scoped_refptr<TabProxy> tab = ActiveTab(); @@ -212,7 +206,7 @@ ErrorCode Session::ExecuteScript(const std::wstring& script, return kUnknownError; } - LOG(INFO) << "...script result: " << result; + VLOG(1) << "...script result: " << result; std::string temp = WideToASCII(result); scoped_ptr<Value> r(base::JSONReader::ReadAndReturnError( temp, true, NULL, NULL)); @@ -225,9 +219,8 @@ ErrorCode Session::ExecuteScript(const std::wstring& script, if (r->GetType() != Value::TYPE_DICTIONARY) { std::ostringstream stream; stream << "Internal script execution error: script result must be a " - << print_valuetype(Value::TYPE_DICTIONARY) - << ", but was " - << print_valuetype(r->GetType()) << ": " << result; + << print_valuetype(Value::TYPE_DICTIONARY) << ", but was " + << print_valuetype(r->GetType()) << ": " << result; *value = Value::CreateStringValue(stream.str()); return kUnknownError; } diff --git a/chrome/test/webdriver/session_manager.cc b/chrome/test/webdriver/session_manager.cc index 245143a..97bda11 100644 --- a/chrome/test/webdriver/session_manager.cc +++ b/chrome/test/webdriver/session_manager.cc @@ -141,8 +141,8 @@ bool SessionManager::Create(std::string* id) { // Start chrome, if it doesn't startup quit. const int ap_timeout = TestTimeouts::command_execution_timeout_ms(); - LOG(INFO) << "Waiting for a max of " << ap_timeout << " ms to " - << "start the chrome browser"; + VLOG(1) << "Waiting for a max of " << ap_timeout << " ms to start the chrome " + "browser"; scoped_ptr<Session> session(new Session(*id)); @@ -162,10 +162,10 @@ bool SessionManager::Has(const std::string& id) const { bool SessionManager::Delete(const std::string& id) { std::map<std::string, Session*>::iterator it; - LOG(INFO) << "Deleting session with ID " << id; + VLOG(1) << "Deleting session with ID " << id; it = map_.find(id); if (it == map_.end()) { - LOG(INFO) << "No such session with ID " << id; + VLOG(1) << "No such session with ID " << id; return false; } @@ -178,7 +178,7 @@ Session* SessionManager::GetSession(const std::string& id) const { std::map<std::string, Session*>::const_iterator it; it = map_.find(id); if (it == map_.end()) { - LOG(INFO) << "No such session with ID " << id; + VLOG(1) << "No such session with ID " << id; return NULL; } return it->second; diff --git a/chrome/test/webdriver/utility_functions.cc b/chrome/test/webdriver/utility_functions.cc index 6744e67..54e5ae8 100644 --- a/chrome/test/webdriver/utility_functions.cc +++ b/chrome/test/webdriver/utility_functions.cc @@ -21,9 +21,8 @@ std::wstring build_atom(const wchar_t* const atom[], const size_t& size) { const size_t len = size / sizeof(atom[0]); std::wstring ret = L""; for (size_t i = 0; i < len; ++i) { - if (atom[i] != NULL) { + if (atom[i] != NULL) ret.append(std::wstring(atom[i])); - } } return ret; } @@ -65,19 +64,17 @@ bool ParseJSONDictionary(const std::string& json, DictionaryValue** dict, Value* params = base::JSONReader::ReadAndReturnError(json, true, &error_code, error); if (error_code != 0) { - LOG(INFO) << "Could not parse JSON object, " << *error << std::endl; - if (params) { + VLOG(1) << "Could not parse JSON object, " << *error; + if (params) delete params; - } return false; } if (!params || params->GetType() != Value::TYPE_DICTIONARY) { *error = "Data passed in URL must be of type dictionary."; - LOG(INFO) << "Invalid type to parse" << std::endl; - if (params) { + VLOG(1) << "Invalid type to parse"; + if (params) delete params; - } return false; } |