summaryrefslogtreecommitdiffstats
path: root/content/test/content_test_suite.cc
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 22:11:44 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 22:11:44 +0000
commit166ea521da0b6fec159d864171e15f1e74785845 (patch)
treed94043a50d77e100c01298e08cef0419c3071e9b /content/test/content_test_suite.cc
parent8dee09204160685d7409a0caf525aea59d87a0c6 (diff)
downloadchromium_src-166ea521da0b6fec159d864171e15f1e74785845.zip
chromium_src-166ea521da0b6fec159d864171e15f1e74785845.tar.gz
chromium_src-166ea521da0b6fec159d864171e15f1e74785845.tar.bz2
Revert 135000 - Re-implement the screensaver to use WebView instead of ExtensionDialogHost.
Use WebView to render the screensaver extension instead of ExtensionDialogHost. Using the RenderViewGone override to detect termination of the renderer process to restart it. Added browser tests. R=ben@chromium.org,sky@chromium.org BUG=chromium-os:28211 TEST=Tested that the screensaver comes up; tested the reload via crashing the extension renderer with SIG_ABRT; also ran browser tests. Review URL: https://chromiumcodereview.appspot.com/10191010 TBR=rkc@chromium.org Review URL: https://chromiumcodereview.appspot.com/10335010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test/content_test_suite.cc')
-rw-r--r--content/test/content_test_suite.cc35
1 files changed, 25 insertions, 10 deletions
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index a81b816b..4272a9c 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -5,11 +5,13 @@
#include "content/test/content_test_suite.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "content/browser/mock_content_browser_client.h"
+#include "content/browser/notification_service_impl.h"
+#include "content/public/common/content_client.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/url_constants.h"
#include "content/test/test_content_client.h"
-#include "content/test/test_content_client_initializer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_paths.h"
@@ -18,27 +20,40 @@
#endif
#include "ui/gfx/compositor/compositor_setup.h"
-
namespace {
-class TestInitializationListener : public testing::EmptyTestEventListener {
+class TestContentClientInitializer : public testing::EmptyTestEventListener {
public:
- TestInitializationListener() : test_content_client_initializer_(NULL) {
+ TestContentClientInitializer() {
}
virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
- test_content_client_initializer_ =
- new content::TestContentClientInitializer();
+ notification_service_.reset(new NotificationServiceImpl());
+
+ DCHECK(!content::GetContentClient());
+ content_client_.reset(new TestContentClient);
+ content::SetContentClient(content_client_.get());
+
+ content_browser_client_.reset(new content::MockContentBrowserClient());
+ content_client_->set_browser(content_browser_client_.get());
}
virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
- delete test_content_client_initializer_;
+ notification_service_.reset();
+
+ DCHECK_EQ(content_client_.get(), content::GetContentClient());
+ content::SetContentClient(NULL);
+ content_client_.reset();
+
+ content_browser_client_.reset();
}
private:
- content::TestContentClientInitializer* test_content_client_initializer_;
+ scoped_ptr<NotificationServiceImpl> notification_service_;
+ scoped_ptr<content::ContentClient> content_client_;
+ scoped_ptr<content::ContentBrowserClient> content_browser_client_;
- DISALLOW_COPY_AND_ASSIGN(TestInitializationListener);
+ DISALLOW_COPY_AND_ASSIGN(TestContentClientInitializer);
};
} // namespace
@@ -70,6 +85,6 @@ void ContentTestSuite::Initialize() {
testing::TestEventListeners& listeners =
testing::UnitTest::GetInstance()->listeners();
- listeners.Append(new TestInitializationListener);
+ listeners.Append(new TestContentClientInitializer);
}