diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_init.cc | 17 | ||||
-rw-r--r-- | chrome/browser/browser_init.h | 2 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 1 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/common/chrome_constants.cc | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation.scons | 1 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 11 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 5 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 13 | ||||
-rw-r--r-- | chrome/test/startup/startup_test.cc | 56 | ||||
-rw-r--r-- | chrome/test/startup/startup_tests.scons | 23 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 112 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 12 | ||||
-rw-r--r-- | chrome/test/ui/ui_tests.scons | 7 |
14 files changed, 142 insertions, 124 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index d4ec343..eb9e965 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -12,6 +12,8 @@ #include "base/string_util.h" #include "base/sys_info.h" #include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/automation/automation_provider.h" +#include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extensions_service.h" @@ -37,8 +39,6 @@ #if defined(OS_WIN) #include "base/win_util.h" -#include "chrome/browser/automation/automation_provider.h" -#include "chrome/browser/automation/automation_provider_list.h" #include "chrome/common/resource_bundle.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -445,7 +445,6 @@ bool BrowserInit::ProcessCommandLine( } } -#if defined(OS_WIN) // Look for the testing channel ID ONLY during process startup if (command_line.HasSwitch(switches::kTestingChannelID)) { std::wstring testing_channel_id = @@ -456,7 +455,9 @@ bool BrowserInit::ProcessCommandLine( // new tab; if there are none then we get one homepage tab. int expected_tab_count = 1; if (command_line.HasSwitch(switches::kRestoreLastSession)) { - StringToInt(command_line.GetSwitchValue(switches::kRestoreLastSession), + std::wstring restore_session_value( + command_line.GetSwitchValue(switches::kRestoreLastSession)); + StringToInt(WideToUTF16Hack(restore_session_value), &expected_tab_count); } else { expected_tab_count = @@ -467,7 +468,6 @@ bool BrowserInit::ProcessCommandLine( profile, static_cast<size_t>(expected_tab_count)); } -#endif } // Allow the command line to override the persisted setting of home page. @@ -477,7 +477,6 @@ bool BrowserInit::ProcessCommandLine( prefs->transient()->SetBoolean(prefs::kStartRenderersManually, true); bool silent_launch = false; -#if defined(OS_WIN) if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { std::wstring automation_channel_id = command_line.GetSwitchValue(switches::kAutomationClientChannelID); @@ -491,7 +490,6 @@ bool BrowserInit::ProcessCommandLine( CreateAutomationProvider<AutomationProvider>(automation_channel_id, profile, expected_tabs); } -#endif if (command_line.HasSwitch(switches::kLoadExtension)) { std::wstring path_string = @@ -531,7 +529,6 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line, return result; } -#if defined(OS_WIN) template <class AutomationProviderClass> void BrowserInit::CreateAutomationProvider(const std::wstring& channel_id, Profile* profile, @@ -542,10 +539,10 @@ void BrowserInit::CreateAutomationProvider(const std::wstring& channel_id, automation->SetExpectedTabCount(expected_tabs); AutomationProviderList* list = - g_browser_process->InitAutomationProviderList(); DCHECK(list); + g_browser_process->InitAutomationProviderList(); + DCHECK(list); list->AddProvider(automation); } -#endif bool BrowserInit::LaunchBrowserImpl(const CommandLine& command_line, Profile* profile, diff --git a/chrome/browser/browser_init.h b/chrome/browser/browser_init.h index e37ab69..909df4f5 100644 --- a/chrome/browser/browser_init.h +++ b/chrome/browser/browser_init.h @@ -102,12 +102,10 @@ class BrowserInit { Profile* profile, const std::wstring& cur_dir, bool process_startup, int* return_code); -#if defined(OS_WIN) template <class AutomationProviderClass> static void CreateAutomationProvider(const std::wstring& channel_id, Profile* profile, size_t expected_tabs); -#endif private: // Does the work of LaunchBrowser returning the result. diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 28d52b5..1d097b5 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -65,7 +65,6 @@ #include "base/registry.h" #include "base/win_util.h" -#include "chrome/browser/automation/automation_provider.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_trial.h" #include "chrome/browser/extensions/extension_protocols.h" diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 3f7c053..09f79ec 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -363,6 +363,8 @@ 'browser/automation/url_request_failed_dns_job.h', 'browser/automation/url_request_slow_download_job.cc', 'browser/automation/url_request_slow_download_job.h', + 'browser/automation/url_request_mock_http_job.cc', + 'browser/automation/url_request_mock_http_job.h', 'browser/bookmarks/bookmark_codec.cc', 'browser/bookmarks/bookmark_codec.h', 'browser/bookmarks/bookmark_context_menu.cc', diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc index 658a243..aee1b07 100644 --- a/chrome/common/chrome_constants.cc +++ b/chrome/common/chrome_constants.cc @@ -12,7 +12,11 @@ namespace chrome { // The following should not be used for UI strings; they are meant // for system strings only. UI changes should be made in the GRD. +#if defined(OS_WIN) const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe"; +#elif defined(OS_LINUX) +const wchar_t kBrowserProcessExecutableName[] = L"chrome"; +#endif #if defined(GOOGLE_CHROME_BUILD) const wchar_t kBrowserAppName[] = L"Chrome"; const char kStatsFilename[] = "ChromeStats2"; diff --git a/chrome/test/automation/automation.scons b/chrome/test/automation/automation.scons index 3f89fdd..b43146a 100644 --- a/chrome/test/automation/automation.scons +++ b/chrome/test/automation/automation.scons @@ -42,7 +42,6 @@ if not env.Bit('windows'): # TODO(port): port. input_files.Remove( 'autocomplete_edit_proxy.cc', - 'browser_proxy.cc', 'constrained_window_proxy.cc', 'tab_proxy.cc', 'window_proxy.cc', diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index 06ec99e..73bb91d 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -402,6 +402,17 @@ BrowserProxy* AutomationProxy::GetLastActiveBrowserWindow() { return new BrowserProxy(this, tracker_.get(), handle); } +#if defined(OS_POSIX) +base::file_handle_mapping_vector AutomationProxy::fds_to_map() const { + base::file_handle_mapping_vector map; + int src_fd = -1, dest_fd = -1; + channel_->GetClientFileDescriptorMapping(&src_fd, &dest_fd); + if (src_fd > -1) + map.push_back(std::make_pair(src_fd, dest_fd)); + return map; +} +#endif // defined(OS_POSIX) + bool AutomationProxy::Send(IPC::Message* message) { return SendWithTimeout(message, base::kNoTimeout, NULL); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 118983b..ff74db3 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -8,6 +8,7 @@ #include <string> #include "base/basictypes.h" +#include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/time.h" #include "base/thread.h" @@ -159,6 +160,10 @@ class AutomationProxy : public IPC::Channel::Listener, // passed to the app as a launch parameter. const std::wstring& channel_id() const { return channel_id_; } +#if defined(OS_POSIX) + base::file_handle_mapping_vector fds_to_map() const; +#endif + // AutomationMessageSender implementations. virtual bool Send(IPC::Message* message); virtual bool SendWithTimeout(IPC::Message* message, int timeout, diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 3a0305d..942919d 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -7,6 +7,7 @@ #include <vector> #include "base/logging.h" +#include "base/platform_thread.h" #include "base/time.h" #include "chrome/test/automation/autocomplete_edit_proxy.h" #include "chrome/test/automation/automation_constants.h" @@ -171,6 +172,8 @@ bool BrowserProxy::ApplyAccelerator(int id) { new AutomationMsg_ApplyAccelerator(0, handle_, id)); } +#if defined(OS_WIN) +// TODO(port): Replace POINT. bool BrowserProxy::SimulateDrag(const POINT& start, const POINT& end, int flags, @@ -200,13 +203,14 @@ bool BrowserProxy::SimulateDragWithTimeout(const POINT& start, return result; } +#endif // defined(OS_WIN) bool BrowserProxy::WaitForTabCountToChange(int count, int* new_count, int wait_timeout) { const TimeTicks start = TimeTicks::Now(); const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); while (TimeTicks::Now() - start < timeout) { - Sleep(automation::kSleepTime); + PlatformThread::Sleep(automation::kSleepTime); bool is_timeout; bool succeeded = GetTabCountWithTimeout(new_count, wait_timeout, &is_timeout); @@ -223,7 +227,7 @@ bool BrowserProxy::WaitForTabCountToBecome(int count, int wait_timeout) { const TimeTicks start = TimeTicks::Now(); const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); while (TimeTicks::Now() - start < timeout) { - Sleep(automation::kSleepTime); + PlatformThread::Sleep(automation::kSleepTime); bool is_timeout; int new_count; bool succeeded = GetTabCountWithTimeout(&new_count, wait_timeout, @@ -242,7 +246,7 @@ bool BrowserProxy::WaitForTabToBecomeActive(int tab, const TimeTicks start = TimeTicks::Now(); const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); while (TimeTicks::Now() - start < timeout) { - Sleep(automation::kSleepTime); + PlatformThread::Sleep(automation::kSleepTime); int active_tab; if (GetActiveTabIndex(&active_tab) && active_tab == tab) return true; @@ -280,6 +284,8 @@ bool BrowserProxy::IsFindWindowFullyVisible(bool* is_visible) { new AutomationMsg_FindWindowVisibility(0, handle_, is_visible)); } +#if defined(OS_WIN) +// TODO(port): Replace HWND. bool BrowserProxy::GetHWND(HWND* handle) const { if (!is_valid()) return false; @@ -291,6 +297,7 @@ bool BrowserProxy::GetHWND(HWND* handle) const { return sender_->Send(new AutomationMsg_WindowHWND(0, handle_, handle)); } +#endif // defined(OS_WIN) bool BrowserProxy::RunCommand(int browser_command) const { if (!is_valid()) diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index c8cf02ae..a07769d 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/platform_thread.h" #include "base/string_util.h" +#include "base/test_file_util.h" #include "base/time.h" +#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/ui/ui_test.h" #include "net/base/net_util.h" @@ -16,18 +19,6 @@ using base::TimeTicks; namespace { -// Wrapper around CopyFile to retry 10 times if there is an error. -// For some reasons on buildbot it happens quite often that -// the test fails because the dll is still in use. -bool CopyFileWrapper(const std::wstring &src, const std::wstring &dest) { - for (int i = 0; i < 10; ++i) { - if (file_util::CopyFile(src, dest)) - return true; - Sleep(1000); - } - return false; -} - class StartupTest : public UITest { public: StartupTest() { @@ -41,24 +32,26 @@ class StartupTest : public UITest { bool test_cold, bool important) { const int kNumCycles = 20; - // Make a backup of gears.dll so we can overwrite the original, which - // flushes the disk cache for that file. - std::wstring chrome_dll, chrome_dll_copy; - ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &chrome_dll)); - file_util::AppendToPath(&chrome_dll, L"chrome.dll"); - chrome_dll_copy = chrome_dll + L".copy"; - ASSERT_TRUE(CopyFileWrapper(chrome_dll, chrome_dll_copy)); - - std::wstring gears_dll, gears_dll_copy; - ASSERT_TRUE(PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_dll)); - gears_dll_copy = gears_dll + L".copy"; - ASSERT_TRUE(CopyFileWrapper(gears_dll, gears_dll_copy)); - TimeDelta timings[kNumCycles]; for (int i = 0; i < kNumCycles; ++i) { if (test_cold) { - ASSERT_TRUE(CopyFileWrapper(chrome_dll_copy, chrome_dll)); - ASSERT_TRUE(CopyFileWrapper(gears_dll_copy, gears_dll)); + FilePath dir_app; + ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app)); + + FilePath chrome_exe(dir_app.Append( + FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName))); + ASSERT_TRUE(file_util::EvictFileFromSystemCache(chrome_exe)); +#if defined(OS_WIN) + // TODO(port): these files do not exist on other platforms. + // Decide what to do. + + FilePath chrome_dll(dir_app.Append(FILE_PATH_LITERAL("chrome.dll"))); + ASSERT_TRUE(file_util::EvictFileFromSystemCache(chrome_dll)); + + FilePath gears_dll; + ASSERT_TRUE(PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_dll)); + ASSERT_TRUE(file_util::EvictFileFromSystemCache(gears_dll)); +#endif // defined(OS_WIN) } UITest::SetUp(); @@ -76,9 +69,6 @@ class StartupTest : public UITest { } } - ASSERT_TRUE(file_util::Delete(chrome_dll_copy, false)); - ASSERT_TRUE(file_util::Delete(gears_dll_copy, false)); - std::wstring times; for (int i = 0; i < kNumCycles; ++i) StringAppendF(×, L"%.2f,", timings[i].InMillisecondsF()); @@ -116,12 +106,16 @@ class StartupFileTest : public StartupTest { pages_ = WideToUTF8(file_url); } }; + } // namespace TEST_F(StartupTest, Perf) { RunStartupTest(L"warm", L"t", false /* not cold */, true /* important */); } +#if defined(OS_WIN) +// TODO(port): Enable reference tests on other platforms. + TEST_F(StartupReferenceTest, Perf) { RunStartupTest(L"warm", L"t_ref", false /* not cold */, true /* important */); @@ -143,3 +137,5 @@ TEST_F(StartupFileTest, PerfColdGears) { false /* not important */); } +#endif // defined(OS_WIN) + diff --git a/chrome/test/startup/startup_tests.scons b/chrome/test/startup/startup_tests.scons index 29c0421..81eefa9 100644 --- a/chrome/test/startup/startup_tests.scons +++ b/chrome/test/startup/startup_tests.scons @@ -10,6 +10,7 @@ env.ApplySConscript([ '$BASE_DIR/using_base.scons', '$BASE_DIR/gfx/using_base_gfx.scons', '$CHROME_SRC_DIR/build/using_googleurl.scons', + '$CHROME_SRC_DIR/tools/grit/build/using_generated_resources.scons', '$GTEST_DIR/../using_gtest.scons', '$ICU38_DIR/using_icu38.scons', '$LIBPNG_DIR/using_libpng.scons', @@ -29,8 +30,9 @@ env.Prepend( LIBS = [ 'automation', 'browser', - 'browser_views', 'common', + 'glue', + 'WTF', ], ) @@ -52,6 +54,7 @@ if env.Bit('windows'): '/nxcompat', ], LIBS = [ + 'browser_views', 'comsupp', 'oleacc', 'rpcrt4', @@ -78,9 +81,21 @@ input_files = ChromeFileList([ ]), ]) -# TODO(port): -if env.Bit('windows'): - env.ChromeTestProgram('startup_tests', input_files) +if not env.Bit('windows'): + # TODO(port): port. + input_files.Remove( + 'feature_startup_test.cc', + ) + + # Windows-specific files + input_files.Remove( + '$CHROME_DIR/tools/build/win/precompiled.cc', + ) + +# Please note that currently you have to manually ensure that Hammer/chrome +# is up to date when you build startup_tests. +# TODO(sgk): Proper dependency tracking for startup_tests. +startup_tests = env.ChromeTestProgram('startup_tests', input_files) p = env.ChromeMSVSProject('startup_tests.vcproj', dest=('$CHROME_SRC_DIR/chrome/' diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 2ad0952..fdcad82 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -24,13 +24,14 @@ #include "chrome/common/debug_flags.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/json_value_serializer.h" +#include "chrome/test/automation/automation_proxy.h" +#include "chrome/test/automation/browser_proxy.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #if defined(OS_WIN) // TODO(port): these just need to be ported. #include "chrome/common/chrome_process_filter.h" -#include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #endif @@ -211,7 +212,6 @@ void UITest::InitializeTimeouts() { } void UITest::LaunchBrowserAndServer() { -#if defined(OS_WIN) // Set up IPC testing interface server. server_.reset(new AutomationProxy(command_execution_timeout_ms_)); @@ -219,26 +219,17 @@ void UITest::LaunchBrowserAndServer() { if (wait_for_initial_loads_) ASSERT_TRUE(server_->WaitForInitialLoads()); else - Sleep(2000); + PlatformThread::Sleep(2000); automation()->SetFilteredInet(true); -#else - // TODO(port): depends on AutomationProxy. - NOTIMPLEMENTED(); -#endif } void UITest::CloseBrowserAndServer() { QuitBrowser(); CleanupAppProcesses(); -#if defined(OS_WIN) // Shut down IPC testing interface. server_.reset(); -#else - // TODO(port): depends on AutomationProxy. - NOTIMPLEMENTED(); -#endif } void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { @@ -265,7 +256,6 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { if (dom_automation_enabled_) command_line.AppendSwitch(switches::kDomAutomationController); -#if defined(OS_WIN) if (include_testing_id_) { if (use_existing_browser_) { // TODO(erikkay): The new switch depends on a browser instance already @@ -280,10 +270,6 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { server_->channel_id()); } } -#else - // TODO(port): depends on AutomationProxy. - NOTIMPLEMENTED(); -#endif if (!show_error_dialogs_ && !CommandLine::ForCurrentProcess()->HasSwitch(kEnableErrorDialogs)) { @@ -346,7 +332,6 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { if (clear_profile) ASSERT_TRUE(DieFileDie(user_data_dir_, true)); -#if defined(OS_WIN) if (!template_user_data_.empty()) { // Recursively copy the template directory to the user_data_dir. ASSERT_TRUE(file_util::CopyRecursiveDirNoCache(template_user_data_, @@ -355,13 +340,21 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { browser_launch_time_ = TimeTicks::Now(); +#if defined(OS_WIN) bool started = base::LaunchApp(command_line, false, // Don't wait for process object // (doesn't work for us) !show_window_, &process_); - ASSERT_EQ(started, true); +#elif defined(OS_POSIX) + bool started = base::LaunchApp(command_line.argv(), + server_->fds_to_map(), + false, // Don't wait. + &process_); +#endif + ASSERT_TRUE(started); +#if defined(OS_WIN) if (use_existing_browser_) { DWORD pid = 0; HWND hwnd = FindWindowEx(HWND_MESSAGE, NULL, chrome::kMessageWindowClass, @@ -381,7 +374,6 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { } void UITest::QuitBrowser() { -#if defined(OS_WIN) typedef std::vector<BrowserProxy*> BrowserVector; // There's nothing to do here if the browser is not running. @@ -416,7 +408,7 @@ void UITest::QuitBrowser() { #ifdef WAIT_FOR_DEBUGGER_ON_OPEN timeout = 500000; #endif - if (WAIT_TIMEOUT == WaitForSingleObject(process_, timeout)) { + if (!base::WaitForSingleProcess(process_, timeout)) { // We need to force the browser to quit because it didn't quit fast // enough. Take no chance and kill every chrome processes. CleanupAppProcesses(); @@ -424,19 +416,15 @@ void UITest::QuitBrowser() { } // Don't forget to close the handle - CloseHandle(process_); + base::CloseProcessHandle(process_); process_ = NULL; -#else - // TODO(port): depends on AutomationProxy. - NOTIMPLEMENTED(); -#endif // OS_WIN } void UITest::AssertAppNotRunning(const std::wstring& error_message) { #if defined(OS_WIN) ASSERT_EQ(0, GetBrowserProcessCount()) << error_message; #else - // TODO(port): depends on AutomationProxy. + // TODO(port): Enable when chrome_process_filter is ported. NOTIMPLEMENTED(); #endif } @@ -570,6 +558,7 @@ std::wstring UITest::GetActiveTabTitle() { EXPECT_TRUE(tab_proxy->GetTabTitle(&title)); return title; } +#endif // defined(OS_WIN) bool UITest::IsBrowserRunning() { return CrashAwareSleep(0); @@ -579,6 +568,9 @@ bool UITest::CrashAwareSleep(int time_out_ms) { return base::CrashAwareSleep(process_, time_out_ms); } +#if defined(OS_WIN) +// TODO(port): Port these. + /*static*/ int UITest::GetBrowserProcessCount() { BrowserProcessFilter filter(L""); @@ -724,37 +716,6 @@ bool UITest::CloseBrowser(BrowserProxy* browser, return result; } -void UITest::PrintResult(const std::wstring& measurement, - const std::wstring& modifier, - const std::wstring& trace, - size_t value, - const std::wstring& units, - bool important) { - std::wstring value_str = StringPrintf(L"%d", value); - PrintResultsImpl(measurement, modifier, trace, value_str, - L"", L"", units, important); -} - -void UITest::PrintResultMeanAndError(const std::wstring& measurement, - const std::wstring& modifier, - const std::wstring& trace, - const std::wstring& mean_and_error, - const std::wstring& units, - bool important) { - PrintResultsImpl(measurement, modifier, trace, mean_and_error, - L"{", L"}", units, important); -} - -void UITest::PrintResultList(const std::wstring& measurement, - const std::wstring& modifier, - const std::wstring& trace, - const std::wstring& values, - const std::wstring& units, - bool important) { - PrintResultsImpl(measurement, modifier, trace, values, - L"[", L"]", units, important); -} - GURL UITest::GetTestUrl(const std::wstring& test_directory, const std::wstring &test_case) { std::wstring path; @@ -791,6 +752,39 @@ void UITest::WaitForFinish(const std::string &name, EXPECT_EQ(true, test_result); } +#endif // OS_WIN + +void UITest::PrintResult(const std::wstring& measurement, + const std::wstring& modifier, + const std::wstring& trace, + size_t value, + const std::wstring& units, + bool important) { + std::wstring value_str = StringPrintf(L"%d", value); + PrintResultsImpl(measurement, modifier, trace, value_str, + L"", L"", units, important); +} + +void UITest::PrintResultMeanAndError(const std::wstring& measurement, + const std::wstring& modifier, + const std::wstring& trace, + const std::wstring& mean_and_error, + const std::wstring& units, + bool important) { + PrintResultsImpl(measurement, modifier, trace, mean_and_error, + L"{", L"}", units, important); +} + +void UITest::PrintResultList(const std::wstring& measurement, + const std::wstring& modifier, + const std::wstring& trace, + const std::wstring& values, + const std::wstring& units, + bool important) { + PrintResultsImpl(measurement, modifier, trace, values, + L"[", L"]", units, important); +} + void UITest::PrintResultsImpl(const std::wstring& measurement, const std::wstring& modifier, const std::wstring& trace, @@ -807,5 +801,3 @@ void UITest::PrintResultsImpl(const std::wstring& measurement, trace.c_str(), prefix.c_str(), values.c_str(), suffix.c_str(), units.c_str()); } - -#endif // OS_WIN diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index a2f1ce8..794391b 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -30,12 +30,10 @@ #include "base/process.h" #include "base/scoped_ptr.h" #include "base/time.h" -#if defined(OS_WIN) // TODO(evanm): we should be able to just forward-declare // AutomationProxy here, but many files that #include this one don't // themselves #include automation_proxy.h. #include "chrome/test/automation/automation_proxy.h" -#endif #include "testing/gtest/include/gtest/gtest.h" class AutomationProxy; @@ -361,14 +359,8 @@ class UITest : public testing::Test { protected: AutomationProxy* automation() { -#if defined(OS_WIN) EXPECT_TRUE(server_.get()); return server_.get(); -#else - // TODO(port): restore when AutomationProxy bits work. - NOTIMPLEMENTED(); - return NULL; -#endif } // Wait a certain amount of time for all the app processes to exit, @@ -438,10 +430,8 @@ class UITest : public testing::Test { // for an test to finish. static std::wstring js_flags_; // Flags passed to the JS engine. static std::wstring log_level_; // Logging level. -#if defined(OS_WIN) - // TODO(port): restore me after AutomationProxy works. + scoped_ptr<AutomationProxy> server_; -#endif MessageLoop message_loop_; // Enables PostTask to main thread. diff --git a/chrome/test/ui/ui_tests.scons b/chrome/test/ui/ui_tests.scons index ada6b90..9bf717a 100644 --- a/chrome/test/ui/ui_tests.scons +++ b/chrome/test/ui/ui_tests.scons @@ -12,6 +12,7 @@ env.SConscript([ '$BZIP2_DIR/using_bzip2.scons', '$CHROME_DIR/third_party/wtl/using_wtl.scons', '$CHROME_SRC_DIR/build/using_googleurl.scons', + '$CHROME_SRC_DIR/tools/grit/build/using_generated_resources.scons', '$GTEST_DIR/../using_gtest.scons', '$ICU38_DIR/using_icu38.scons', '$LIBPNG_DIR/using_libpng.scons', @@ -34,9 +35,13 @@ env.Prepend( 'UI_TEST', ], LIBS = [ + 'automation', 'browser', 'common', + 'glue', + 'port', 'sqlite', + 'WTF', ] ) @@ -45,11 +50,9 @@ if env.Bit('windows'): # lower env.Prepend (for win-specific libs). env.Prepend( LIBS = [ - 'automation', 'browser_views', 'npapi_layout_test_plugin', 'npapi_test_plugin', - 'port', 'security_tests', ], ) |