summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 23:40:57 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 23:40:57 +0000
commit4be6fe689be1bb26bcef371326c3e9daf04ad5aa (patch)
treeda8e1173a9563119f707dd27b6478440bf5ac896 /ash
parent347e8c4ec523d41a2a8dc00f1a56a18028585b33 (diff)
downloadchromium_src-4be6fe689be1bb26bcef371326c3e9daf04ad5aa.zip
chromium_src-4be6fe689be1bb26bcef371326c3e9daf04ad5aa.tar.gz
chromium_src-4be6fe689be1bb26bcef371326c3e9daf04ad5aa.tar.bz2
Fix view view in views examples.
The views delegate used in Views Examples derives from TestViewsDelegate, which returns a TestWebContents when WebView tries to create it's webcontents. Since this functionality is intended only for unit tests, moved the test webcontents creation to a subclass of TestViewsDelegate in ash_test_base. This leaves TestViewsDelegate and it's subclasses unaffected. R=ben@chromium.org BUG=None. TEST=Ran aura_test_unittests and verified that the webview example in views examples through ash_shell works correctly. Review URL: https://chromiumcodereview.appspot.com/10447096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/screensaver/screensaver_view_unittest.cc5
-rw-r--r--ash/test/ash_test_base.cc8
-rw-r--r--ash/test/ash_test_base.h9
3 files changed, 19 insertions, 3 deletions
diff --git a/ash/screensaver/screensaver_view_unittest.cc b/ash/screensaver/screensaver_view_unittest.cc
index 47a19e2..25cfb6d 100644
--- a/ash/screensaver/screensaver_view_unittest.cc
+++ b/ash/screensaver/screensaver_view_unittest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "content/public/browser/browser_context.h"
#include "ui/views/controls/webview/webview.h"
-#include "ui/views/test/test_views_delegate.h"
#include "ui/views/test/webview_test_helper.h"
namespace ash {
@@ -18,7 +17,7 @@ class ScreensaverViewTest : public ash::test::AshTestBase {
public:
ScreensaverViewTest() {
url_ = GURL("http://www.google.com");
- views_delegate_.reset(new views::TestViewsDelegate);
+ views_delegate_.reset(new AshTestViewsDelegate);
webview_test_helper_.reset(new views::WebViewTestHelper(message_loop()));
}
@@ -57,7 +56,7 @@ class ScreensaverViewTest : public ash::test::AshTestBase {
GURL url_;
private:
- scoped_ptr<views::TestViewsDelegate> views_delegate_;
+ scoped_ptr<AshTestViewsDelegate> views_delegate_;
scoped_ptr<views::WebViewTestHelper> webview_test_helper_;
DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest);
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index ca7b9fc..0e6b72b 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -8,6 +8,7 @@
#include "ash/shell.h"
#include "ash/test/test_shell_delegate.h"
+#include "content/test/web_contents_tester.h"
#include "ui/aura/env.h"
#include "ui/aura/monitor_manager.h"
#include "ui/aura/root_window.h"
@@ -18,6 +19,13 @@
namespace ash {
namespace test {
+content::WebContents* AshTestViewsDelegate::CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) {
+ return content::WebContentsTester::CreateTestWebContents(browser_context,
+ site_instance);
+}
+
AshTestBase::AshTestBase() {
}
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index c118a8a..61d739f 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -10,10 +10,19 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/views/test/test_views_delegate.h"
namespace ash {
namespace test {
+class AshTestViewsDelegate : public views::TestViewsDelegate {
+ public:
+ // Overriden from TestViewsDelegate.
+ content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) OVERRIDE;
+};
+
class AshTestBase : public testing::Test {
public:
AshTestBase();