| OLD | NEW |
| 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 "ui/views/controls/webview/webview.h" | 10 #include "ui/views/controls/webview/webview.h" |
| 11 #include "ui/views/test/test_views_delegate.h" | |
| 12 #include "ui/views/test/webview_test_helper.h" | 11 #include "ui/views/test/webview_test_helper.h" |
| 13 | 12 |
| 14 namespace ash { | 13 namespace ash { |
| 15 namespace test { | 14 namespace test { |
| 16 | 15 |
| 17 class ScreensaverViewTest : public ash::test::AshTestBase { | 16 class ScreensaverViewTest : public ash::test::AshTestBase { |
| 18 public: | 17 public: |
| 19 ScreensaverViewTest() { | 18 ScreensaverViewTest() { |
| 20 url_ = GURL("http://www.google.com"); | 19 url_ = GURL("http://www.google.com"); |
| 21 views_delegate_.reset(new views::TestViewsDelegate); | 20 views_delegate_.reset(new AshTestViewsDelegate); |
| 22 webview_test_helper_.reset(new views::WebViewTestHelper(message_loop())); | 21 webview_test_helper_.reset(new views::WebViewTestHelper(message_loop())); |
| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 } | 49 } |
| 51 | 50 |
| 52 void ExpectClosedScreensaver() { | 51 void ExpectClosedScreensaver() { |
| 53 EXPECT_TRUE(internal::ScreensaverView::GetInstance() == NULL); | 52 EXPECT_TRUE(internal::ScreensaverView::GetInstance() == NULL); |
| 54 } | 53 } |
| 55 | 54 |
| 56 protected: | 55 protected: |
| 57 GURL url_; | 56 GURL url_; |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 scoped_ptr<views::TestViewsDelegate> views_delegate_; | 59 scoped_ptr<AshTestViewsDelegate> views_delegate_; |
| 61 scoped_ptr<views::WebViewTestHelper> webview_test_helper_; | 60 scoped_ptr<views::WebViewTestHelper> webview_test_helper_; |
| 62 | 61 |
| 63 DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest); | 62 DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest); |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 TEST_F(ScreensaverViewTest, ShowScreensaverAndClose) { | 65 TEST_F(ScreensaverViewTest, ShowScreensaverAndClose) { |
| 67 ash::ShowScreensaver(url_); | 66 ash::ShowScreensaver(url_); |
| 68 RunAllPendingInMessageLoop(); | 67 RunAllPendingInMessageLoop(); |
| 69 ExpectOpenScreensaver(); | 68 ExpectOpenScreensaver(); |
| 70 | 69 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 84 RunAllPendingInMessageLoop(); | 83 RunAllPendingInMessageLoop(); |
| 85 | 84 |
| 86 ash::CloseScreensaver(); | 85 ash::CloseScreensaver(); |
| 87 ExpectClosedScreensaver(); | 86 ExpectClosedScreensaver(); |
| 88 ash::CloseScreensaver(); | 87 ash::CloseScreensaver(); |
| 89 ExpectClosedScreensaver(); | 88 ExpectClosedScreensaver(); |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace test | 91 } // namespace test |
| 93 } // namespace ash | 92 } // namespace ash |
| OLD | NEW |