diff options
author | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 20:42:26 +0000 |
---|---|---|
committer | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 20:42:26 +0000 |
commit | 7b253107bbb058bd2b685da8b3ae8ea34339c345 (patch) | |
tree | 5b38f78838795a9d5031c69779049f5bc51f0b9d /content | |
parent | c2ed3f695815db91d328203a8e57d6495497c6ff (diff) | |
download | chromium_src-7b253107bbb058bd2b685da8b3ae8ea34339c345.zip chromium_src-7b253107bbb058bd2b685da8b3ae8ea34339c345.tar.gz chromium_src-7b253107bbb058bd2b685da8b3ae8ea34339c345.tar.bz2 |
Revert 179635
> [content shell] ShellRenderProcessObserver no longer depends on WebTestInterfaces.
>
> R=jochen
> BUG=173079
>
> Review URL: https://chromiumcodereview.appspot.com/12090066
TBR=marja@chromium.org
BUG=173456
Review URL: https://codereview.chromium.org/12124002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/fileapi/blob_layout_browsertest.cc | 90 | ||||
-rw-r--r-- | content/browser/fileapi/file_system_browsertest.cc | 10 | ||||
-rw-r--r-- | content/shell/shell_content_renderer_client.cc | 42 | ||||
-rw-r--r-- | content/shell/shell_content_renderer_client.h | 5 | ||||
-rw-r--r-- | content/shell/shell_render_process_observer.cc | 9 | ||||
-rw-r--r-- | content/shell/shell_render_process_observer.h | 5 |
6 files changed, 113 insertions, 48 deletions
diff --git a/content/browser/fileapi/blob_layout_browsertest.cc b/content/browser/fileapi/blob_layout_browsertest.cc index 8188965..4f42c87 100644 --- a/content/browser/fileapi/blob_layout_browsertest.cc +++ b/content/browser/fileapi/blob_layout_browsertest.cc @@ -19,15 +19,23 @@ IN_PROC_BROWSER_TEST_F(BlobLayoutTest, SliceTests) { RunLayoutTest("blob-slice-test.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_ApplyBlobUrlToImg) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_ApplyBlobUrlToImg DISABLED_ApplyBlobUrlToImg +#else +# define MAYBE_ApplyBlobUrlToImg ApplyBlobUrlToImg +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_ApplyBlobUrlToImg) { RunLayoutTest("apply-blob-url-to-img.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_ApplyBlobUrlToXhr) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_ApplyBlobUrlToXhr DISABLED_ApplyBlobUrlToXhr +#else +# define MAYBE_ApplyBlobUrlToXhr ApplyBlobUrlToXhr +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_ApplyBlobUrlToXhr) { RunLayoutTest("apply-blob-url-to-xhr.html"); } @@ -54,21 +62,33 @@ IN_PROC_BROWSER_TEST_F(BlobLayoutTest, RunLayoutTest("domurl-script-execution-context-crash.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_FileListTest) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_FileListTest DISABLED_FileListTest +#else +# define MAYBE_FileListTest FileListTest +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_FileListTest) { RunLayoutTest("file-list-test.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_FileReaderAbort) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_FileReaderAbort DISABLED_FileReaderAbort +#else +# define MAYBE_FileReaderAbort FileReaderAbort +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_FileReaderAbort) { RunLayoutTest("file-reader-abort.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_FileReaderDirectoryCrash) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_FileReaderDirectoryCrash DISABLED_FileReaderDirectoryCrash +#else +# define MAYBE_FileReaderDirectoryCrash FileReaderDirectoryCrash +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_FileReaderDirectoryCrash) { RunLayoutTest("file-reader-directory-crash.html"); } @@ -76,9 +96,13 @@ IN_PROC_BROWSER_TEST_F(BlobLayoutTest, FileReaderDoneReadingAbort) { RunLayoutTest("file-reader-done-reading-abort.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_FileReaderEventListener) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_FileReaderEventListener DISABLED_FileReaderEventListener +#else +# define MAYBE_FileReaderEventListener FileReaderEventListener +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_FileReaderEventListener) { RunLayoutTest("file-reader-event-listener.html"); } @@ -104,21 +128,33 @@ IN_PROC_BROWSER_TEST_F(BlobLayoutTest, NotEnoughArguments) { RunLayoutTest("not-enough-arguments.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_NullOriginString) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_NullOriginString DISABLED_NullOriginString +#else +# define MAYBE_NullOriginString NullOriginString +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_NullOriginString) { RunLayoutTest("null-origin-string.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_ReadBlobAsync) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_ReadBlobAsync DISABLED_ReadBlobAsync +#else +# define MAYBE_ReadBlobAsync ReadBlobAsync +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_ReadBlobAsync) { RunLayoutTest("read-blob-async.html"); } -// crbug.com/169240 for disabling on Windows, crbug.com/173079 for temporary -// disabling everywhere. -IN_PROC_BROWSER_TEST_F(BlobLayoutTest, DISABLED_ReadFileAsync) { +#if defined(OS_WIN) +// http://crbug/169240 +# define MAYBE_ReadFileAsync DISABLED_ReadFileAsync +#else +# define MAYBE_ReadFileAsync ReadFileAsync +#endif +IN_PROC_BROWSER_TEST_F(BlobLayoutTest, MAYBE_ReadFileAsync) { RunLayoutTest("read-file-async.html"); } diff --git a/content/browser/fileapi/file_system_browsertest.cc b/content/browser/fileapi/file_system_browsertest.cc index e9fa9cf..72cb661 100644 --- a/content/browser/fileapi/file_system_browsertest.cc +++ b/content/browser/fileapi/file_system_browsertest.cc @@ -108,9 +108,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemLayoutTest, AsyncOperations) { RunLayoutTest("async-operations.html"); } -// crbug.com/172787 for disabling on Windows (flaky), crbug.com/173079 for -// temporary disabling everywhere. -IN_PROC_BROWSER_TEST_F(FileSystemLayoutTest, DISABLED_CrossFilesystemOp) { +#if defined(OS_WIN) +// Flaky timeouts on windows. http://crbug.com/172787 +# define MAYBE_CrossFilesystemOp DISABLED_CrossFilesystemOp +#else +# define MAYBE_CrossFilesystemOp CrossFilesystemOp +#endif +IN_PROC_BROWSER_TEST_F(FileSystemLayoutTest, MAYBE_CrossFilesystemOp) { RunLayoutTest("cross-filesystem-op.html"); } diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc index 5c15618..f342444 100644 --- a/content/shell/shell_content_renderer_client.cc +++ b/content/shell/shell_content_renderer_client.cc @@ -48,6 +48,11 @@ bool IsExternalPage(const GURL& url) { } // namespace ShellContentRendererClient::ShellContentRendererClient() { + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { + EnableWebTestProxyCreation( + base::Bind(&ShellContentRendererClient::WebTestProxyCreated, + base::Unretained(this))); + } } ShellContentRendererClient::~ShellContentRendererClient() { @@ -57,15 +62,6 @@ void ShellContentRendererClient::RenderThreadStarted() { shell_observer_.reset(new ShellRenderProcessObserver()); } -void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { - WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); - if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) { - ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view, - test_runner, - test_runner); - } -} - bool ShellContentRendererClient::OverrideCreatePlugin( RenderView* render_view, WebKit::WebFrame* frame, @@ -101,18 +97,30 @@ bool ShellContentRendererClient::WillSendRequest( ShellRenderProcessObserver::GetInstance(); if (!command_line->HasSwitch(switches::kAllowExternalPages) && IsExternalPage(url) && !IsExternalPage(first_party_for_cookies)) { - if (render_process_observer->test_delegate()) { - render_process_observer->test_delegate()->printMessage( - std::string("Blocked access to external URL " + url.spec() + "\n")); - } + render_process_observer->test_delegate()->printMessage( + std::string("Blocked access to external URL " + url.spec() + "\n")); *new_url = GURL(); return true; } - if (render_process_observer->test_delegate()) { - *new_url = render_process_observer->test_delegate()->rewriteLayoutTestsURL( - url.spec()); - } + *new_url = render_process_observer->test_delegate()->rewriteLayoutTestsURL( + url.spec()); return true; } +void ShellContentRendererClient::WebTestProxyCreated(RenderView* render_view, + WebTestProxyBase* proxy) { + WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); + if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) { + ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view, + test_runner, + test_runner); + } + test_runner->set_proxy(proxy); + proxy->setDelegate( + ShellRenderProcessObserver::GetInstance()->test_delegate()); + proxy->setInterfaces( + ShellRenderProcessObserver::GetInstance()->test_interfaces()); + render_view->GetWebView()->setSpellCheckClient(proxy->spellCheckClient()); +} + } // namespace content diff --git a/content/shell/shell_content_renderer_client.h b/content/shell/shell_content_renderer_client.h index b8c1bc7..a71e3b4 100644 --- a/content/shell/shell_content_renderer_client.h +++ b/content/shell/shell_content_renderer_client.h @@ -29,7 +29,6 @@ class ShellContentRendererClient : public ContentRendererClient { ShellContentRendererClient(); virtual ~ShellContentRendererClient(); virtual void RenderThreadStarted() OVERRIDE; - virtual void RenderViewCreated(RenderView* render_view) OVERRIDE; virtual bool OverrideCreatePlugin( RenderView* render_view, WebKit::WebFrame* frame, @@ -42,6 +41,10 @@ class ShellContentRendererClient : public ContentRendererClient { GURL* new_url) OVERRIDE; private: + void WebTestProxyCreated(RenderView* render_view, + WebTestRunner::WebTestProxyBase* proxy); + GURL RewriteLayoutTestsURL(const GURL& url); + scoped_ptr<ShellRenderProcessObserver> shell_observer_; }; diff --git a/content/shell/shell_render_process_observer.cc b/content/shell/shell_render_process_observer.cc index fff9bfc..a592b79 100644 --- a/content/shell/shell_render_process_observer.cc +++ b/content/shell/shell_render_process_observer.cc @@ -15,6 +15,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h" #include "webkit/glue/webkit_glue.h" #include "webkit/support/gc_extension.h" @@ -22,6 +23,7 @@ using WebKit::WebFrame; using WebKit::WebRuntimeFeatures; using WebKit::WebTestingSupport; using WebTestRunner::WebTestDelegate; +using WebTestRunner::WebTestInterfaces; namespace content { @@ -61,6 +63,9 @@ void ShellRenderProcessObserver::SetMainWindow( RenderView* view, WebKitTestRunner* test_runner, WebTestDelegate* delegate) { + test_interfaces_->setDelegate(delegate); + test_interfaces_->setWebView(view->GetWebView()); + test_interfaces_->setTestRunner(test_runner); main_render_view_ = view; main_test_runner_ = test_runner; test_delegate_ = delegate; @@ -68,6 +73,7 @@ void ShellRenderProcessObserver::SetMainWindow( void ShellRenderProcessObserver::BindTestRunnersToWindow(WebFrame* frame) { WebTestingSupport::injectInternalsObject(frame); + test_interfaces_->bindTo(frame); } void ShellRenderProcessObserver::WebKitInitialized() { @@ -81,6 +87,8 @@ void ShellRenderProcessObserver::WebKitInitialized() { // We always expose GC to layout tests. webkit_glue::SetJavaScriptFlags(" --expose-gc"); RenderThread::Get()->RegisterExtension(extensions_v8::GCExtension::Get()); + + test_interfaces_.reset(new WebTestInterfaces); } bool ShellRenderProcessObserver::OnControlMessageReceived( @@ -96,6 +104,7 @@ bool ShellRenderProcessObserver::OnControlMessageReceived( } void ShellRenderProcessObserver::OnResetAll() { + test_interfaces_->resetAll(); if (main_render_view_) { main_test_runner_->Reset(); WebTestingSupport::resetInternalsObject( diff --git a/content/shell/shell_render_process_observer.h b/content/shell/shell_render_process_observer.h index 1f8932d..baa1e7b 100644 --- a/content/shell/shell_render_process_observer.h +++ b/content/shell/shell_render_process_observer.h @@ -17,6 +17,7 @@ class WebFrame; namespace WebTestRunner { class WebTestDelegate; +class WebTestInterfaces; } namespace content { @@ -43,6 +44,9 @@ class ShellRenderProcessObserver : public RenderProcessObserver { WebTestRunner::WebTestDelegate* test_delegate() const { return test_delegate_; } + WebTestRunner::WebTestInterfaces* test_interfaces() const { + return test_interfaces_.get(); + } WebKitTestRunner* main_test_runner() const { return main_test_runner_; } const FilePath& webkit_source_dir() const { return webkit_source_dir_; } @@ -51,6 +55,7 @@ class ShellRenderProcessObserver : public RenderProcessObserver { void OnResetAll(); void OnSetWebKitSourceDir(const FilePath& webkit_source_dir); + scoped_ptr<WebTestRunner::WebTestInterfaces> test_interfaces_; RenderView* main_render_view_; WebKitTestRunner* main_test_runner_; WebTestRunner::WebTestDelegate* test_delegate_; |