diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-28 17:17:10 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-28 17:17:10 +0000 |
commit | 76fdc21de47ba710cd71f1d06ca55362b118c390 (patch) | |
tree | d9ec9563c0229fbce61def9bb34b24bf713c11a5 | |
parent | e19516d9748c6bfc5798880dc0bbe03374d722c4 (diff) | |
download | chromium_src-76fdc21de47ba710cd71f1d06ca55362b118c390.zip chromium_src-76fdc21de47ba710cd71f1d06ca55362b118c390.tar.gz chromium_src-76fdc21de47ba710cd71f1d06ca55362b118c390.tar.bz2 |
Relanding this:
This patch adds a new kind of tests: browser tests.
They are intended to provide an alternative to the UI tests, hopefully helping
with flackiness.
These tests are in-process browser test.
There are 2 projects to build the tests:
- the browser_test.dll that contains the tests, the gtest framework and the
browser classes.
- the browser_test_launcher.exe.
The launcher loads the browser_test.dll for each test, run the test and then
unloads the DLL. This insures the static initializers are run before each test
and that any atexit handler is invoked properly.
This is Windows only for now.
BUG=9764
TEST=Run browser_test.exe
TBR=maruel
Review URL: http://codereview.chromium.org/99097
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14738 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ssl/ssl_browser_tests.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win_browsertest.cc (renamed from chrome/browser/views/find_bar_win_unittest.cc) | 6 | ||||
-rw-r--r-- | chrome/chrome.sln | 70 | ||||
-rw-r--r-- | chrome/test/browser/browser_tests_dll.vcproj | 304 | ||||
-rw-r--r-- | chrome/test/browser/browser_tests_launcher.cc | 174 | ||||
-rw-r--r-- | chrome/test/browser/browser_tests_launcher.vcproj | 160 | ||||
-rw-r--r-- | chrome/test/browser/run_all_unittests.cc | 45 | ||||
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 11 | ||||
-rw-r--r-- | chrome/test/unit/unittests.vcproj | 4 | ||||
-rw-r--r-- | chrome/tools/build/win/browser_tests_dll.vsprops | 18 |
10 files changed, 793 insertions, 19 deletions
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc new file mode 100644 index 0000000..c2a49c4 --- /dev/null +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -0,0 +1,20 @@ +// Copyright (c) 2009 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 "net/base/ssl_test_util.h" + +#include "chrome/test/in_process_browser_test.h" + +namespace { + +const wchar_t* const kDocRoot = L"chrome/test/data"; + +class SSLBrowserTest : public InProcessBrowserTest { +}; + +} // namespace + +// TODO(jcampan): port SSLUITest to SSLBrowserTest. +IN_PROC_BROWSER_TEST_F(SSLBrowserTest, TestHTTP) { +} diff --git a/chrome/browser/views/find_bar_win_unittest.cc b/chrome/browser/views/find_bar_win_browsertest.cc index 2d50ff2..4cca160 100644 --- a/chrome/browser/views/find_bar_win_unittest.cc +++ b/chrome/browser/views/find_bar_win_browsertest.cc @@ -7,8 +7,8 @@ #include "chrome/browser/find_notification_details.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" +#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/views/find_bar_win.h" #include "chrome/common/notification_service.h" #include "chrome/test/in_process_browser_test.h" @@ -159,9 +159,7 @@ std::string FocusedOnPage(WebContents* web_contents) { // This tests the FindInPage end-state, in other words: what is focused when you // close the Find box (ie. if you find within a link the link should be // focused). -// TODO(jcampan): This test needs to be enabled once Jay fixes the issues with -// running two InProc browser tests that both start a web server (crashes). -IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, DISABLED_FindInPageEndState) { +IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { HTTPTestServer* server = StartHTTPServer(); // First we navigate to our special focus tracking page. diff --git a/chrome/chrome.sln b/chrome/chrome.sln index 7770602..eb92232 100644 --- a/chrome/chrome.sln +++ b/chrome/chrome.sln @@ -1434,6 +1434,58 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v8_nosnapshot", "..\build\t {EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "browser_tests_dll", "test\browser\browser_tests_dll.vcproj", "{D7589D0D-304E-4589-85A4-153B7D84B07F}" + ProjectSection(ProjectDependencies) = postProject + {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} + {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} + {20A560A0-2CD0-4D9E-A58B-1F24B99C087A} = {20A560A0-2CD0-4D9E-A58B-1F24B99C087A} + {21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179} + {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} + {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} + {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} + {5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700} + {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} + {5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6} + {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} + {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} + {625A8F11-2B4E-45B4-BD99-C6D629C606C0} = {625A8F11-2B4E-45B4-BD99-C6D629C606C0} + {6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9} = {6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9} + {6F9258E5-294F-47B2-919D-17FFE7A8B751} = {6F9258E5-294F-47B2-919D-17FFE7A8B751} + {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} + {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} + {7F0A70F6-BE3F-4C19-B435-956AB8F30BA4} = {7F0A70F6-BE3F-4C19-B435-956AB8F30BA4} + {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} + {899F1280-3441-4D1F-BA04-CCD6208D9146} = {899F1280-3441-4D1F-BA04-CCD6208D9146} + {8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308} + {9301A569-5D2B-4D11-9332-B1E30AEACB8D} = {9301A569-5D2B-4D11-9332-B1E30AEACB8D} + {9E5416B9-B91B-4029-93F4-102C1AD5CAF4} = {9E5416B9-B91B-4029-93F4-102C1AD5CAF4} + {A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551} + {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6} + {B95AB527-F7DB-41E9-AD91-EB51EE0F56BE} = {B95AB527-F7DB-41E9-AD91-EB51EE0F56BE} + {BF4F447B-72B5-4059-BE1B-F94337B1F385} = {BF4F447B-72B5-4059-BE1B-F94337B1F385} + {BFE8E2A7-3B3B-43B0-A994-3058B852DB8B} = {BFE8E2A7-3B3B-43B0-A994-3058B852DB8B} + {C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD} + {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} = {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} + {CAE2D1E6-3F19-492F-A35C-68AA7ACAD6D3} = {CAE2D1E6-3F19-492F-A35C-68AA7ACAD6D3} + {CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D} + {D5E8DCB2-9C61-446F-8BEE-B18CA0E0936E} = {D5E8DCB2-9C61-446F-8BEE-B18CA0E0936E} + {D9DDAF60-663F-49CC-90DC-3D08CC3D1B28} = {D9DDAF60-663F-49CC-90DC-3D08CC3D1B28} + {EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142} + {EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C} + {EFBB1436-A63F-4CD8-9E99-B89226E782EC} = {EFBB1436-A63F-4CD8-9E99-B89226E782EC} + {F4F4BCAA-EA59-445C-A119-3E6C29647A51} = {F4F4BCAA-EA59-445C-A119-3E6C29647A51} + {F54ABC59-5C00-414A-A9BA-BAF26D1699F0} = {F54ABC59-5C00-414A-A9BA-BAF26D1699F0} + {FA537565-7B03-4FFC-AF15-F7A979B72E22} = {FA537565-7B03-4FFC-AF15-F7A979B72E22} + {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} + {FD683DD6-D9BF-4B1B-AB6D-A3AC03EDAA4D} = {FD683DD6-D9BF-4B1B-AB6D-A3AC03EDAA4D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "browser_tests_launcher", "test\browser\browser_tests_launcher.vcproj", "{9B87804D-2502-480B-95AE-5A572CE91809}" + ProjectSection(ProjectDependencies) = postProject + {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcmalloc", "..\third_party\tcmalloc\tcmalloc.vcproj", "{C564F145-9172-42C3-BFCB-60FDEA124321}" EndProject Global @@ -2124,6 +2176,14 @@ Global {9946A048-043B-4F8F-9E07-9297B204714C}.Release|Mixed Platforms.Build.0 = Release|Win32 {9946A048-043B-4F8F-9E07-9297B204714C}.Release|Win32.ActiveCfg = Release|Win32 {9946A048-043B-4F8F-9E07-9297B204714C}.Release|Win32.Build.0 = Release|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Debug|Win32.ActiveCfg = Debug|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Debug|Win32.Build.0 = Debug|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Release|Mixed Platforms.Build.0 = Release|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Release|Win32.ActiveCfg = Release|Win32 + {9B87804D-2502-480B-95AE-5A572CE91809}.Release|Win32.Build.0 = Release|Win32 {9D13D9B8-6C28-42A7-935C-B769EBC55BAA}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {9D13D9B8-6C28-42A7-935C-B769EBC55BAA}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {9D13D9B8-6C28-42A7-935C-B769EBC55BAA}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -2538,6 +2598,14 @@ Global {D703D7A0-EDC1-4FE6-9E22-56154155B24E}.Release|Mixed Platforms.Build.0 = Release|Win32 {D703D7A0-EDC1-4FE6-9E22-56154155B24E}.Release|Win32.ActiveCfg = Release|Win32 {D703D7A0-EDC1-4FE6-9E22-56154155B24E}.Release|Win32.Build.0 = Release|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Debug|Win32.Build.0 = Debug|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Release|Mixed Platforms.Build.0 = Release|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Release|Win32.ActiveCfg = Release|Win32 + {D7589D0D-304E-4589-85A4-153B7D84B07F}.Release|Win32.Build.0 = Release|Win32 {D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -2858,6 +2926,7 @@ Global {9055E088-25C6-47FD-87D5-D9DD9FD75C9F} = {1174D37F-6ABB-45DA-81B3-C631281273B7} {9301A569-5D2B-4D11-9332-B1E30AEACB8D} = {97555540-8163-4D0F-BCAC-EFA0FFED3453} {9946A048-043B-4F8F-9E07-9297B204714C} = {873D095E-150E-4262-8C41-2D8ED02F0F57} + {9B87804D-2502-480B-95AE-5A572CE91809} = {1174D37F-6ABB-45DA-81B3-C631281273B7} {9D13D9B8-6C28-42A7-935C-B769EBC55BAA} = {2325D8C4-8EF5-42AC-8900-492225750DE4} {9DA4FACA-4A4D-3A23-B349-475C2237F827} = {B353A6A5-9551-4B76-908E-0F0A9B31E4CE} {9E5416B9-B91B-4029-93F4-102C1AD5CAF4} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} @@ -2911,6 +2980,7 @@ Global {D5E8DCB2-9C61-446F-8BEE-B18CA0E0936E} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} {D6047981-23AE-4623-9373-514FDAFAE60F} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} {D703D7A0-EDC1-4FE6-9E22-56154155B24E} = {97555540-8163-4D0F-BCAC-EFA0FFED3453} + {D7589D0D-304E-4589-85A4-153B7D84B07F} = {1174D37F-6ABB-45DA-81B3-C631281273B7} {D7A94F58-576A-45D9-A45F-EB87C63ABBB0} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} {D7ED06E8-6138-4CE3-A906-5EF1D9C804E0} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} {D9DDAF60-663F-49CC-90DC-3D08CC3D1B28} = {B6867423-23BD-4588-9321-2D500F128A3D} diff --git a/chrome/test/browser/browser_tests_dll.vcproj b/chrome/test/browser/browser_tests_dll.vcproj new file mode 100644 index 0000000..8c1658f --- /dev/null +++ b/chrome/test/browser/browser_tests_dll.vcproj @@ -0,0 +1,304 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="browser_tests_dll"
+ ProjectGUID="{D7589D0D-304E-4589-85A4-153B7D84B07F}"
+ RootNamespace="browser_tests_dll"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ <ToolFile
+ RelativePath="..\..\tools\build\win\version.rules"
+ />
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\debug.vsprops;$(SolutionDir)..\testing\using_gtest.vsprops;$(SolutionDir)installer\util\using_util.vsprops;$(SolutionDir)..\third_party\ffmpeg\using_ffmpeg.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\third_party\zlib\using_zlib.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)tools\build\win\browser_tests_dll.vsprops;$(SolutionDir)tools\build\win\precompiled_wtl.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="Version"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\browser_tests.dll"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\testing\using_gtest.vsprops;$(SolutionDir)installer\util\using_util.vsprops;$(SolutionDir)..\third_party\ffmpeg\using_ffmpeg.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\third_party\zlib\using_zlib.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)tools\build\win\browser_tests_dll.vsprops;$(SolutionDir)tools\build\win\precompiled_wtl.vsprops;$(SolutionDir)..\build\release.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="Version"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\browser_tests.dll"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Common"
+ >
+ <File
+ RelativePath="..\unit\chrome_test_suite.h"
+ >
+ </File>
+ <File
+ RelativePath="..\in_process_browser_test.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\in_process_browser_test.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\tools\build\win\precompiled_wtl.cc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\tools\build\win\precompiled_wtl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\run_all_unittests.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\ui_test_utils.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\ui_test_utils.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="TestSSL"
+ >
+ <File
+ RelativePath="..\..\browser\ssl\ssl_browser_tests.cc"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="resources"
+ >
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\aliasb.cur"
+ >
+ </File>
+ <File
+ RelativePath="$(OutDir)\grit_derived_sources\browser_resources.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\cell.cur"
+ >
+ </File>
+ <File
+ RelativePath="..\..\app\chrome_dll.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\app\chrome_dll_resource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\app\chrome_dll_version.rc.version"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\col_resize.cur"
+ >
+ </File>
+ <File
+ RelativePath="$(OutDir)\grit_derived_sources\common_resources.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\copy.cur"
+ >
+ </File>
+ <File
+ RelativePath="$(OutDir)\grit_derived_sources\debugger_resources.rc"
+ >
+ </File>
+ <File
+ RelativePath="$(OutDir)\obj\global_intermediate\net\net_resources.rc"
+ >
+ </File>
+ <File
+ RelativePath="$(OutDir)\grit_derived_sources\renderer_resources.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\data\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\data\resource.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\row_resize.cur"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\vertical_text.cur"
+ >
+ </File>
+ <File
+ RelativePath="$(OutDir)\grit_derived_sources\webkit_resources.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\zoom_in.cur"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\webkit\glue\resources\zoom_out.cur"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="TestFindInPage"
+ >
+ <File
+ RelativePath="..\..\browser\views\find_bar_win_browsertest.cc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/chrome/test/browser/browser_tests_launcher.cc b/chrome/test/browser/browser_tests_launcher.cc new file mode 100644 index 0000000..34ec60c --- /dev/null +++ b/chrome/test/browser/browser_tests_launcher.cc @@ -0,0 +1,174 @@ +// Copyright (c) 2009 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 <windows.h> + +#include <vector> + +#include "base/command_line.h" +#include "base/logging.h" +#include "base/process_util.h" +#include "base/string_util.h" + +namespace { + +const wchar_t* const kBrowserTestDLLName = L"browser_tests.dll"; +const wchar_t* const kGTestListTestsFlag = L"gtest_list_tests"; +} + +// TestEnvContext takes care of loading/unloading the DLL containing the tests. +class TestEnvContext { + public: + TestEnvContext() + : module_(NULL), + run_test_proc_(NULL) { + } + + ~TestEnvContext() { + if (!module_) + return; + BOOL r = ::FreeLibrary(module_); + DCHECK(r); + LOG(INFO) << "Unloaded " << kBrowserTestDLLName; + } + + bool Init() { + module_ = ::LoadLibrary(kBrowserTestDLLName); + if (!module_) { + LOG(ERROR) << "Failed to find " << kBrowserTestDLLName; + return false; + } + + run_test_proc_ = reinterpret_cast<RunTestProc>( + ::GetProcAddress(module_, "RunTests")); + if (!run_test_proc_) { + LOG(ERROR) << + "Failed to find RunTest function in " << kBrowserTestDLLName; + return false; + } + + return true; + } + + // Returns true if the test succeeded, false if it failed. + bool RunTest(const std::string& test_name) { + std::string filter_flag = StringPrintf("--gtest_filter=%s", + test_name.c_str()); + char* argv[2]; + argv[0] = ""; + argv[1] = const_cast<char*>(filter_flag.c_str()); + return RunAsIs(2, argv) == 0; + } + + // Calls-in to GTest with the arguments we were started with. + int RunAsIs(int argc, char** argv) { + return (run_test_proc_)(argc, argv); + } + + private: + typedef int (__cdecl *RunTestProc)(int, char**); + + HMODULE module_; + RunTestProc run_test_proc_; +}; + +// Retrieves the list of tests to run. +// Simply uses the --gtest_list_tests option which honor the filter. +// Sadly there is no dry-run option (or willingness to get such an option) in +// GTest. So we'll have to process disabled and repeat options ourselves. +bool GetTestList(const CommandLine& command_line, + std::vector<std::string>* test_list) { + DCHECK(!command_line.HasSwitch(kGTestListTestsFlag)); + + // Run ourselves with the --gtest_list_tests option and read the output. + std::wstring new_command_line = command_line.command_line_string() + L" --" + + kGTestListTestsFlag; + std::string output; + if (!base::GetAppOutput(new_command_line, &output)) + return false; + + // Now let's parse the returned output. + // It looks like: + // TestCase. + // Test1 + // Test2 + // OtherTestCase. + // FooTest + // ... + std::vector<std::string> lines; + SplitString(output, '\n', &lines); + + std::string test_case; + for (std::vector<std::string>::const_iterator iter = lines.begin(); + iter != lines.end(); ++iter) { + std::string line = *iter; + if (line.empty()) + continue; // Just ignore empty lines if any. + + if (line[line.size() - 1] == '.') { + // This is a new test case. + test_case = line; + continue; + } + // We are dealing with a test. + test_list->push_back(test_case + line); + } + return true; +} + +int main(int argc, char** argv) { + CommandLine::Init(argc, argv); + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + + if (command_line->HasSwitch(kGTestListTestsFlag)) { + TestEnvContext test_context; + if (!test_context.Init()) + return 1; + return test_context.RunAsIs(argc, argv); + } + + // First let's get the list of tests we need to run. + std::vector<std::string> test_list; + if (!GetTestList(*command_line, &test_list)) { + printf("Failed to retrieve the tests to run.\n"); + return 0; + } + + if (test_list.empty()) { + printf("No tests to run.\n"); + return 0; + } + + // Run the tests. + int test_run_count = 0; + std::vector<std::string> failed_tests; + for (std::vector<std::string>::const_iterator iter = test_list.begin(); + iter != test_list.end(); ++iter) { + std::string test_name = *iter; + TestEnvContext test_context; + if (!test_context.Init()) + return 1; + test_run_count++; + if (!test_context.RunTest(test_name.c_str())) { + if (std::find(failed_tests.begin(), failed_tests.end(), test_name) == + failed_tests.end()) { + failed_tests.push_back(*iter); + } + } + } + + printf("%d test%s run\n", test_run_count, test_run_count > 1 ? "s" : ""); + printf("%d test%s failed\n", failed_tests.size(), + failed_tests.size() > 1 ? "s" : ""); + if (failed_tests.empty()) + return 0; + + printf("Failing tests:\n"); + for (std::vector<std::string>::const_iterator iter = failed_tests.begin(); + iter != failed_tests.end(); ++iter) { + printf("%s\n", iter->c_str()); + } + + return 1; +} diff --git a/chrome/test/browser/browser_tests_launcher.vcproj b/chrome/test/browser/browser_tests_launcher.vcproj new file mode 100644 index 0000000..ee1c651 --- /dev/null +++ b/chrome/test/browser/browser_tests_launcher.vcproj @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="browser_tests_launcher"
+ ProjectGUID="{9B87804D-2502-480B-95AE-5A572CE91809}"
+ RootNamespace="browser_tests_launcher"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ <ToolFile
+ RelativePath="..\..\tools\build\win\version.rules"
+ />
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\debug.vsprops;$(SolutionDir)installer\util\using_util.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="Version"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\browser_tests.exe"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\release.vsprops;$(SolutionDir)installer\util\using_util.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="Version"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\browser_tests.exe"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\browser_tests_launcher.cc"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/chrome/test/browser/run_all_unittests.cc b/chrome/test/browser/run_all_unittests.cc new file mode 100644 index 0000000..f8f7d57 --- /dev/null +++ b/chrome/test/browser/run_all_unittests.cc @@ -0,0 +1,45 @@ +// Copyright (c) 2009 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/string_util.h" +#include "chrome/test/unit/chrome_test_suite.h" + +#if defined(OS_WIN) +#define DLLEXPORT __declspec(dllexport) +#elif +#define DLLEXPORT +#endif + +// We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. +extern "C" { +DLLEXPORT int __cdecl RunTests(int argc, char **argv) { + return ChromeTestSuite(argc, argv).Run(); +} +} + +#if defined(OS_WIN) +BOOL WINAPI DllMain(HINSTANCE dll_module, DWORD reason, LPVOID reserved) { + if (reason == DLL_PROCESS_DETACH) { + // The CRichEditCtrl (used by the omnibox) calls OleInitialize, but somehow + // does not always calls OleUninitialize, causing an unbalanced Ole + // initialization that triggers a DCHECK in ScopedOleInitializer the next + // time we run a test. + // This behavior has been seen on some Vista boxes, but not all of them. + // There is a flag to prevent Ole initialization in CRichEditCtrl (see + // http://support.microsoft.com/kb/238989), but it is set to 0 in recent + // Windows versions. + // This is a dirty hack to make sure the OleCount is back to 0 in all cases, + // so the next test will have Ole unitialized, as expected. + + if (OleInitialize(NULL) == S_FALSE) { + // We were already initialized, balance that extra-initialization. + OleUninitialize(); + } + // Balance the OleInitialize from the above test. + OleUninitialize(); + } + return TRUE; +} + +#endif diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 1b454a3..4c68f57 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -44,15 +44,6 @@ bool DieFileDie(const std::wstring& file, bool recurse) { return false; } -class ShadowingAtExitManager : public base::AtExitManager { - public: - ShadowingAtExitManager() : base::AtExitManager(true) {} - virtual ~ShadowingAtExitManager() {} - - private: - DISALLOW_COPY_AND_ASSIGN(ShadowingAtExitManager); -}; - } // namespace InProcessBrowserTest::InProcessBrowserTest() @@ -64,8 +55,6 @@ InProcessBrowserTest::InProcessBrowserTest() } void InProcessBrowserTest::SetUp() { - ShadowingAtExitManager at_exit_manager; - // Cleanup the user data dir. std::wstring user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj index 631b37c..0dc8102 100644 --- a/chrome/test/unit/unittests.vcproj +++ b/chrome/test/unit/unittests.vcproj @@ -520,10 +520,6 @@ > </File> <File - RelativePath="..\..\browser\views\find_bar_win_unittest.cc" - > - </File> - <File RelativePath="..\..\browser\importer\firefox_importer_unittest.cc" > </File> diff --git a/chrome/tools/build/win/browser_tests_dll.vsprops b/chrome/tools/build/win/browser_tests_dll.vsprops new file mode 100644 index 0000000..4498ca8 --- /dev/null +++ b/chrome/tools/build/win/browser_tests_dll.vsprops @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="browser_tests_dll"
+ InheritedPropertySheets="$(SolutionDir)tools\build\win\unit_test.vsprops"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""$(IntDir)""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+</VisualStudioPropertySheet>
|