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

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

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « ash/screensaver/screensaver_view.cc ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/screensaver/screensaver_view.h"
6
7 #include "ash/test/ash_test_base.h"
8 #include "base/bind.h"
9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/web_contents.h"
11 #include "ui/views/controls/webview/webview.h"
12 #include "ui/views/test/webview_test_helper.h"
13
14 namespace ash {
15 namespace test {
16
17 class ScreensaverViewTest : public ash::test::AshTestBase {
18 public:
19 ScreensaverViewTest() {
20 url_ = GURL("http://www.google.com");
21 webview_test_helper_.reset(new views::WebViewTestHelper());
22 }
23
24 ~ScreensaverViewTest() override {}
25
26 void SetUp() override {
27 AshTestBase::SetUp();
28 RunAllPendingInMessageLoop();
29 }
30
31 void ExpectOpenScreensaver() {
32 ScreensaverView* screensaver = ScreensaverView::GetInstance();
33 EXPECT_TRUE(screensaver != NULL);
34 if (!screensaver) return;
35 EXPECT_TRUE(screensaver->IsScreensaverShowingURL(url_));
36 }
37
38 void ExpectClosedScreensaver() {
39 EXPECT_TRUE(ScreensaverView::GetInstance() == NULL);
40 }
41
42 protected:
43 GURL url_;
44
45 private:
46 scoped_ptr<views::WebViewTestHelper> webview_test_helper_;
47
48 DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest);
49 };
50
51 TEST_F(ScreensaverViewTest, ShowScreensaverAndClose) {
52 ash::ShowScreensaver(url_);
53 RunAllPendingInMessageLoop();
54 ExpectOpenScreensaver();
55
56 ash::CloseScreensaver();
57 ExpectClosedScreensaver();
58 }
59
60 TEST_F(ScreensaverViewTest, OutOfOrderMultipleShowAndClose) {
61 ash::CloseScreensaver();
62 ExpectClosedScreensaver();
63
64 ash::ShowScreensaver(url_);
65 ExpectOpenScreensaver();
66 RunAllPendingInMessageLoop();
67 ash::ShowScreensaver(url_);
68 ExpectOpenScreensaver();
69 RunAllPendingInMessageLoop();
70
71 ash::CloseScreensaver();
72 ExpectClosedScreensaver();
73 ash::CloseScreensaver();
74 ExpectClosedScreensaver();
75 }
76
77 } // namespace test
78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screensaver/screensaver_view.cc ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698