Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: ash/screensaver/screensaver_view_unittest.cc

Issue 280863002: Reduce creation of ViewsDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add widget includes for undef CreateWindow Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/first_run/first_run_helper_unittest.cc ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/screensaver/screensaver_view.h" 5 #include "ash/screensaver/screensaver_view.h"
6 6
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "ui/views/controls/webview/webview.h" 11 #include "ui/views/controls/webview/webview.h"
12 #include "ui/views/test/webview_test_helper.h" 12 #include "ui/views/test/webview_test_helper.h"
13 13
14 namespace ash { 14 namespace ash {
15 namespace test { 15 namespace test {
16 16
17 class ScreensaverViewTest : public ash::test::AshTestBase { 17 class ScreensaverViewTest : public ash::test::AshTestBase {
18 public: 18 public:
19 ScreensaverViewTest() { 19 ScreensaverViewTest() {
20 url_ = GURL("http://www.google.com"); 20 url_ = GURL("http://www.google.com");
21 views_delegate_.reset(new AshTestViewsDelegate());
22 webview_test_helper_.reset(new views::WebViewTestHelper()); 21 webview_test_helper_.reset(new views::WebViewTestHelper());
23 } 22 }
24 23
25 virtual ~ScreensaverViewTest() {} 24 virtual ~ScreensaverViewTest() {}
26 25
27 virtual void SetUp() OVERRIDE { 26 virtual void SetUp() OVERRIDE {
28 AshTestBase::SetUp(); 27 AshTestBase::SetUp();
29 RunAllPendingInMessageLoop(); 28 RunAllPendingInMessageLoop();
30 } 29 }
31 30
32 void ExpectOpenScreensaver() { 31 void ExpectOpenScreensaver() {
33 ScreensaverView* screensaver = ScreensaverView::GetInstance(); 32 ScreensaverView* screensaver = ScreensaverView::GetInstance();
34 EXPECT_TRUE(screensaver != NULL); 33 EXPECT_TRUE(screensaver != NULL);
35 if (!screensaver) return; 34 if (!screensaver) return;
36 EXPECT_TRUE(screensaver->IsScreensaverShowingURL(url_)); 35 EXPECT_TRUE(screensaver->IsScreensaverShowingURL(url_));
37 } 36 }
38 37
39 void ExpectClosedScreensaver() { 38 void ExpectClosedScreensaver() {
40 EXPECT_TRUE(ScreensaverView::GetInstance() == NULL); 39 EXPECT_TRUE(ScreensaverView::GetInstance() == NULL);
41 } 40 }
42 41
43 protected: 42 protected:
44 GURL url_; 43 GURL url_;
45 44
46 private: 45 private:
47 scoped_ptr<AshTestViewsDelegate> views_delegate_;
48 scoped_ptr<views::WebViewTestHelper> webview_test_helper_; 46 scoped_ptr<views::WebViewTestHelper> webview_test_helper_;
49 47
50 DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest); 48 DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest);
51 }; 49 };
52 50
53 TEST_F(ScreensaverViewTest, ShowScreensaverAndClose) { 51 TEST_F(ScreensaverViewTest, ShowScreensaverAndClose) {
54 ash::ShowScreensaver(url_); 52 ash::ShowScreensaver(url_);
55 RunAllPendingInMessageLoop(); 53 RunAllPendingInMessageLoop();
56 ExpectOpenScreensaver(); 54 ExpectOpenScreensaver();
57 55
(...skipping 13 matching lines...) Expand all
71 RunAllPendingInMessageLoop(); 69 RunAllPendingInMessageLoop();
72 70
73 ash::CloseScreensaver(); 71 ash::CloseScreensaver();
74 ExpectClosedScreensaver(); 72 ExpectClosedScreensaver();
75 ash::CloseScreensaver(); 73 ash::CloseScreensaver();
76 ExpectClosedScreensaver(); 74 ExpectClosedScreensaver();
77 } 75 }
78 76
79 } // namespace test 77 } // namespace test
80 } // namespace ash 78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/first_run/first_run_helper_unittest.cc ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698