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

Side by Side Diff: chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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
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 "chrome/browser/chromeos/screensaver/screensaver_controller.h" 5 #include "chrome/browser/chromeos/screensaver/screensaver_controller.h"
6 6
7 #include "ash/screensaver/screensaver_view.h" 7 #include "ash/screensaver/screensaver_view.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 class ScreensaverControllerTest : public InProcessBrowserTest { 49 class ScreensaverControllerTest : public InProcessBrowserTest {
50 }; 50 };
51 51
52 IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, Basic) { 52 IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, Basic) {
53 scoped_refptr<extensions::Extension> extension( 53 scoped_refptr<extensions::Extension> extension(
54 CreateTestScreensaverExtension()); 54 CreateTestScreensaverExtension());
55 InstallExtensionToDefaultProfile(extension); 55 InstallExtensionToDefaultProfile(extension);
56 56
57 scoped_ptr<ScreensaverController> controller_; 57 scoped_ptr<ScreensaverController> controller_;
58 controller_.reset(new ScreensaverController()); 58 controller_.reset(new ScreensaverController());
59 MessageLoop::current()->RunUntilIdle(); 59 base::MessageLoop::current()->RunUntilIdle();
60 60
61 // Trigger idle. 61 // Trigger idle.
62 controller_->IdleNotify(0); 62 controller_->IdleNotify(0);
63 EXPECT_TRUE(ash::IsScreensaverShown()); 63 EXPECT_TRUE(ash::IsScreensaverShown());
64 64
65 // Trigger active. 65 // Trigger active.
66 controller_->OnUserActivity(); 66 controller_->OnUserActivity();
67 EXPECT_FALSE(ash::IsScreensaverShown()); 67 EXPECT_FALSE(ash::IsScreensaverShown());
68 }; 68 };
69 69
70 IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, OutOfOrder) { 70 IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, OutOfOrder) {
71 scoped_refptr<extensions::Extension> extension( 71 scoped_refptr<extensions::Extension> extension(
72 CreateTestScreensaverExtension()); 72 CreateTestScreensaverExtension());
73 InstallExtensionToDefaultProfile(extension); 73 InstallExtensionToDefaultProfile(extension);
74 74
75 scoped_ptr<ScreensaverController> controller_; 75 scoped_ptr<ScreensaverController> controller_;
76 controller_.reset(new ScreensaverController()); 76 controller_.reset(new ScreensaverController());
77 MessageLoop::current()->RunUntilIdle(); 77 base::MessageLoop::current()->RunUntilIdle();
78 78
79 // Trigger active. 79 // Trigger active.
80 controller_->OnUserActivity(); 80 controller_->OnUserActivity();
81 EXPECT_FALSE(ash::IsScreensaverShown()); 81 EXPECT_FALSE(ash::IsScreensaverShown());
82 82
83 // Trigger idle. 83 // Trigger idle.
84 controller_->IdleNotify(0); 84 controller_->IdleNotify(0);
85 EXPECT_TRUE(ash::IsScreensaverShown()); 85 EXPECT_TRUE(ash::IsScreensaverShown());
86 86
87 87
88 // Trigger idle. 88 // Trigger idle.
89 controller_->IdleNotify(0); 89 controller_->IdleNotify(0);
90 EXPECT_TRUE(ash::IsScreensaverShown()); 90 EXPECT_TRUE(ash::IsScreensaverShown());
91 91
92 // Trigger active. 92 // Trigger active.
93 controller_->OnUserActivity(); 93 controller_->OnUserActivity();
94 EXPECT_FALSE(ash::IsScreensaverShown()); 94 EXPECT_FALSE(ash::IsScreensaverShown());
95 }; 95 };
96 96
97 } // namespace chromeos. 97 } // namespace chromeos.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698