Commit f9b85d83 authored by joi@chromium.org's avatar joi@chromium.org

This goes most of the way to re-enabling chrome_frame_net_tests by making it a...

This goes most of the way to re-enabling chrome_frame_net_tests by making it a content::BrowserMainParts.  The tests are still disabled until we are able to test them on IE8 and older; on IE9 all tests currently pass except for a few that hang.

Additionally, this makes chrome_frame_net_tests determine protocol version using the exact same version information as npchrome_frame.dll does, so that version mismatch due to the RC dependency problems we have sometimes seen should not happen any more with this test suite.

While in there, I also updated the poor_mans_trybot.bat script.

BUG=105435

Review URL: http://codereview.chromium.org/8894008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114080 0039d316-1c4b-4281-b951-d872f2087c98
parent 810aa6d0
...@@ -30,7 +30,6 @@ class BrowserOnlineStateObserver; ...@@ -30,7 +30,6 @@ class BrowserOnlineStateObserver;
class ChromeNetLog; class ChromeNetLog;
class ChromeResourceDispatcherHostDelegate; class ChromeResourceDispatcherHostDelegate;
class CommandLine; class CommandLine;
class ChromeFrameFriendOfBrowserProcessImpl; // TODO(joi): Remove
class RemoteDebuggingServer; class RemoteDebuggingServer;
class TabCloseableStateWatcher; class TabCloseableStateWatcher;
...@@ -128,9 +127,6 @@ class BrowserProcessImpl : public BrowserProcess, ...@@ -128,9 +127,6 @@ class BrowserProcessImpl : public BrowserProcess,
virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE;
private: private:
// TODO(joi): Remove. Temporary hack to get at CreateIOThreadState.
friend class ChromeFrameFriendOfBrowserProcessImpl;
// Must be called right before the IO thread is started. // Must be called right before the IO thread is started.
void CreateIOThreadState(); void CreateIOThreadState();
......
...@@ -379,6 +379,7 @@ ...@@ -379,6 +379,7 @@
'../chrome/chrome.gyp:renderer', '../chrome/chrome.gyp:renderer',
'../chrome/chrome.gyp:syncapi_core', '../chrome/chrome.gyp:syncapi_core',
'../chrome/chrome_resources.gyp:chrome_resources', '../chrome/chrome_resources.gyp:chrome_resources',
'../content/content.gyp:content_app',
'../content/content.gyp:content_gpu', '../content/content.gyp:content_gpu',
'../content/content.gyp:test_support_content', '../content/content.gyp:test_support_content',
'../net/net.gyp:net', '../net/net.gyp:net',
......
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/file_path.h" #include "base/file_path.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/process.h"
#include "base/win/scoped_handle.h" #include "base/win/scoped_handle.h"
#include "chrome/app/scoped_ole_initializer.h" #include "chrome/app/scoped_ole_initializer.h"
#include "chrome/browser/browser_process_impl.h" #include "chrome/browser/browser_process_impl.h"
...@@ -17,9 +18,11 @@ ...@@ -17,9 +18,11 @@
#include "chrome_frame/test/net/test_automation_provider.h" #include "chrome_frame/test/net/test_automation_provider.h"
#include "chrome_frame/test/test_server.h" #include "chrome_frame/test/test_server.h"
#include "chrome_frame/test_utils.h" #include "chrome_frame/test_utils.h"
#include "content/test/test_browser_thread.h" #include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/net_test_suite.h" #include "net/base/net_test_suite.h"
class FakeBrowserProcessImpl;
class ProcessSingleton; class ProcessSingleton;
namespace content { namespace content {
...@@ -39,27 +42,33 @@ class FakeExternalTab { ...@@ -39,27 +42,33 @@ class FakeExternalTab {
return user_data_dir_; return user_data_dir_;
} }
MessageLoopForUI* ui_loop() { FakeBrowserProcessImpl* browser_process() const;
return &loop_;
}
protected: protected:
MessageLoopForUI loop_; scoped_ptr<FakeBrowserProcessImpl> browser_process_;
scoped_ptr<BrowserProcess> browser_process_;
FilePath overridden_user_dir_; FilePath overridden_user_dir_;
FilePath user_data_dir_; FilePath user_data_dir_;
scoped_ptr<ProcessSingleton> process_singleton_; scoped_ptr<ProcessSingleton> process_singleton_;
scoped_ptr<content::NotificationService> notificaton_service_; scoped_ptr<content::NotificationService> notificaton_service_;
DISALLOW_COPY_AND_ASSIGN(FakeExternalTab);
}; };
// The "master class" that spins the UI and test threads. // The "master class" that spins the UI and test threads.
//
// In this weird test executable that pretends to almost be Chrome, it
// plays a similar role to ChromeBrowserMainParts, and must fulfill
// the existing contract between ChromeBrowserMainParts and
// BrowserProcessImpl, i.e. poking BrowserProcessImpl at certain
// lifetime events.
class CFUrlRequestUnittestRunner class CFUrlRequestUnittestRunner
: public NetTestSuite, : public NetTestSuite,
public ProcessSingletonSubclassDelegate, public ProcessSingletonSubclassDelegate,
public TestAutomationProviderDelegate { public TestAutomationProviderDelegate,
public content::BrowserMainParts {
public: public:
CFUrlRequestUnittestRunner(int argc, char** argv); CFUrlRequestUnittestRunner(int argc, char** argv);
~CFUrlRequestUnittestRunner(); virtual ~CFUrlRequestUnittestRunner();
virtual void StartChromeFrameInHostBrowser(); virtual void StartChromeFrameInHostBrowser();
...@@ -76,8 +85,6 @@ class CFUrlRequestUnittestRunner ...@@ -76,8 +85,6 @@ class CFUrlRequestUnittestRunner
// TestAutomationProviderDelegate. // TestAutomationProviderDelegate.
virtual void OnInitialTabLoaded(); virtual void OnInitialTabLoaded();
void RunMainUIThread();
void StartTests(); void StartTests();
// Borrowed from TestSuite::Initialize(). // Borrowed from TestSuite::Initialize().
...@@ -87,6 +94,27 @@ class CFUrlRequestUnittestRunner ...@@ -87,6 +94,27 @@ class CFUrlRequestUnittestRunner
return test_result_; return test_result_;
} }
void set_crash_service(base::ProcessHandle handle) {
crash_service_ = handle;
}
// content::BrowserMainParts implementation.
virtual void PreEarlyInitialization() OVERRIDE;
virtual void PostEarlyInitialization() OVERRIDE {}
virtual void PreMainMessageLoopStart() OVERRIDE {}
virtual void PostMainMessageLoopStart() OVERRIDE {}
virtual void ToolkitInitialized() OVERRIDE {}
virtual void PreCreateThreads() OVERRIDE;
virtual void PreStartThread(content::BrowserThread::ID identifier) OVERRIDE;
virtual void PostStartThread(
content::BrowserThread::ID identifier) OVERRIDE;
virtual void PreMainMessageLoopRun() OVERRIDE;
virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
virtual void PostMainMessageLoopRun() OVERRIDE;
virtual void PreStopThread(content::BrowserThread::ID identifier) OVERRIDE;
virtual void PostStopThread(content::BrowserThread::ID identifier) OVERRIDE;
virtual void PostDestroyThreads() OVERRIDE;
protected: protected:
// This is the thread that runs all the UrlRequest tests. // This is the thread that runs all the UrlRequest tests.
// Within its context, the Initialize() and Shutdown() routines above // Within its context, the Initialize() and Shutdown() routines above
...@@ -97,24 +125,19 @@ class CFUrlRequestUnittestRunner ...@@ -97,24 +125,19 @@ class CFUrlRequestUnittestRunner
protected: protected:
base::win::ScopedHandle test_thread_; base::win::ScopedHandle test_thread_;
base::ProcessHandle crash_service_;
DWORD test_thread_id_; DWORD test_thread_id_;
scoped_ptr<test_server::SimpleWebServer> test_http_server_; scoped_ptr<test_server::SimpleWebServer> test_http_server_;
test_server::SimpleResponse chrome_frame_html_; test_server::SimpleResponse chrome_frame_html_;
// The fake chrome instance. This instance owns the UI message loop // The fake chrome instance.
// on the main thread. scoped_ptr<FakeExternalTab> fake_chrome_;
FakeExternalTab fake_chrome_;
scoped_ptr<ProcessSingletonSubclass> pss_subclass_; scoped_ptr<ProcessSingletonSubclass> pss_subclass_;
scoped_ptr<content::TestBrowserThread> main_thread_;
ScopedChromeFrameRegistrar registrar_; ScopedChromeFrameRegistrar registrar_;
int test_result_; int test_result_;
// TODO(joi): This should be fixed so that this test executable uses DISALLOW_COPY_AND_ASSIGN(CFUrlRequestUnittestRunner);
// content::BrowserMainParts. As it stands it is a horrible hack.
scoped_ptr<content::TestBrowserThread> db_thread_;
scoped_ptr<content::TestBrowserThread> file_thread_;
scoped_ptr<content::TestBrowserThread> io_thread_;
}; };
#endif // CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_ #endif // CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
...@@ -99,10 +99,17 @@ net::URLRequestJob* TestAutomationProvider::Factory(net::URLRequest* request, ...@@ -99,10 +99,17 @@ net::URLRequestJob* TestAutomationProvider::Factory(net::URLRequest* request,
} }
std::string TestAutomationProvider::GetProtocolVersion() { std::string TestAutomationProvider::GetProtocolVersion() {
// Return the version of chrome.dll // Return the version of npchrome_frame.dll. We used to use
// chrome.dll, but the other end of the pipe in this case is
// actually npchrome_frame.dll (which fetches its version info from
// itself), and occasionally we run into RC dependency problems in
// incremental builds so that the version information does not get
// updated in one module but does in another, so better to use the
// exact same version to avoid hard-to-debug problems in development
// builds.
FilePath path; FilePath path;
PathService::Get(base::DIR_MODULE, &path); PathService::Get(base::DIR_MODULE, &path);
path = path.AppendASCII("chrome.dll"); path = path.AppendASCII("npchrome_frame.dll");
std::string version; std::string version;
scoped_ptr<FileVersionInfo> version_info( scoped_ptr<FileVersionInfo> version_info(
......
@ECHO OFF @ECHO OFF
REM Copyright (c) 2009 The Chromium Authors. All rights reserved. REM Copyright (c) 2011 The Chromium Authors. All rights reserved.
REM Use of this source code is governed by a BSD-style license that can be REM Use of this source code is governed by a BSD-style license that can be
REM found in the LICENSE file. REM found in the LICENSE file.
REM REM
...@@ -59,22 +59,31 @@ mkdir base ...@@ -59,22 +59,31 @@ mkdir base
mkdir build\%CONFIG% mkdir build\%CONFIG%
mkdir chrome_frame\test\data mkdir chrome_frame\test\data
mkdir chrome_frame\test\html_util_test_data mkdir chrome_frame\test\html_util_test_data
mkdir net\data
mkdir net\tools\testserver
mkdir third_party\pyftpdlib
mkdir third_party\pylib
mkdir third_party\python_26
mkdir third_party\tlslite
copy %CLIENT_ROOT%\base\base_paths_win.cc base\base_paths_win.cc copy %CLIENT_ROOT%\base\base_paths_win.cc base\base_paths_win.cc
xcopy %CLIENT_ROOT%\build\%CONFIG% build\%CONFIG% /E /EXCLUDE:%CLIENT_ROOT%\chrome_frame\test\poor_mans_trybot_xcopy_filter.txt xcopy %CLIENT_ROOT%\build\%CONFIG% build\%CONFIG% /E /EXCLUDE:%CLIENT_ROOT%\chrome_frame\test\poor_mans_trybot_xcopy_filter.txt
xcopy %CLIENT_ROOT%\chrome_frame\test\data chrome_frame\test\data /E xcopy %CLIENT_ROOT%\chrome_frame\test\data chrome_frame\test\data /E
xcopy %CLIENT_ROOT%\net\data net\data /E
xcopy %CLIENT_ROOT%\net\tools\testserver net\tools\testserver /E
xcopy %CLIENT_ROOT%\third_party\pyftpdlib third_party\pyftpdlib /E
xcopy %CLIENT_ROOT%\third_party\pylib third_party\pylib /E
xcopy %CLIENT_ROOT%\third_party\python_26 third_party\python_26 /E
xcopy %CLIENT_ROOT%\third_party\tlslite third_party\tlslite /E
xcopy %CLIENT_ROOT%\chrome_frame\test\html_util_test_data chrome_frame\test\html_util_test_data /E xcopy %CLIENT_ROOT%\chrome_frame\test\html_util_test_data chrome_frame\test\html_util_test_data /E
copy %CLIENT_ROOT%\chrome_frame\CFInstance.js chrome_frame\CFInstance.js copy %CLIENT_ROOT%\chrome_frame\CFInstance.js chrome_frame\CFInstance.js
copy %CLIENT_ROOT%\chrome_frame\CFInstall.js chrome_frame\CFInstall.js copy %CLIENT_ROOT%\chrome_frame\CFInstall.js chrome_frame\CFInstall.js
@ECHO OFF @ECHO OFF
echo ************************************ echo ************************************
echo DO THE FOLLOWING IN AN ADMIN PROMPT: echo DO THE FOLLOWING IN AN ADMIN PROMPT:
echo ************************************
echo regsvr32 \trybot\build\%CONFIG%\servers\npchrome_frame.dll
echo *********************************
echo THEN DO THIS IN A REGULAR PROMPT:
echo ********************************* echo *********************************
echo \trybot\build\%CONFIG%\chrome_frame_unittests.exe echo %DRIVE%%INSTALL_ROOT%\build\%CONFIG%\chrome_frame_unittests.exe
echo \trybot\build\%CONFIG%\chrome_frame_tests.exe echo %DRIVE%%INSTALL_ROOT%\build\%CONFIG%\chrome_frame_tests.exe
echo %DRIVE%%INSTALL_ROOT%\build\%CONFIG%\chrome_frame_net_tests.exe
goto end goto end
:usage :usage
......
...@@ -45,6 +45,10 @@ void NetTestSuite::Shutdown() { ...@@ -45,6 +45,10 @@ void NetTestSuite::Shutdown() {
void NetTestSuite::InitializeTestThread() { void NetTestSuite::InitializeTestThread() {
network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock());
InitializeTestThreadNoNetworkChangeNotifier();
}
void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() {
host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); scoped_host_resolver_proc_.Init(host_resolver_proc_.get());
// In case any attempts are made to resolve host names, force them all to // In case any attempts are made to resolve host names, force them all to
......
...@@ -34,6 +34,12 @@ class NetTestSuite : public base::TestSuite { ...@@ -34,6 +34,12 @@ class NetTestSuite : public base::TestSuite {
// initialization that can only be done once. // initialization that can only be done once.
void InitializeTestThread(); void InitializeTestThread();
// Same as above, except it does not create a mock
// NetworkChangeNotifier. Use this if your test needs to create and
// manage its own mock NetworkChangeNotifier, or if your test uses
// the production NetworkChangeNotifier.
void InitializeTestThreadNoNetworkChangeNotifier();
private: private:
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
scoped_ptr<MessageLoop> message_loop_; scoped_ptr<MessageLoop> message_loop_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment