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

Side by Side Diff: content/browser/wake_lock/wake_lock_browsertest.cc

Issue 1832813002: Add mojom module suffix in .mojom files in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/test/test_timeouts.h" 6 #include "base/test/test_timeouts.h"
7 #include "content/browser/wake_lock/wake_lock_service_context.h" 7 #include "content/browser/wake_lock/wake_lock_service_context.h"
8 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return GetWebContentsImpl()->GetWakeLockServiceContext(); 66 return GetWebContentsImpl()->GetWakeLockServiceContext();
67 } 67 }
68 68
69 bool HasWakeLock() { 69 bool HasWakeLock() {
70 return GetWakeLockServiceContext()->HasWakeLockForTests(); 70 return GetWakeLockServiceContext()->HasWakeLockForTests();
71 } 71 }
72 72
73 void WaitForPossibleUpdate() { 73 void WaitForPossibleUpdate() {
74 // As Mojo channels have no common FIFO order in respect to each other and 74 // As Mojo channels have no common FIFO order in respect to each other and
75 // to the Chromium IPC, we cannot assume that when screen.keepAwake state 75 // to the Chromium IPC, we cannot assume that when screen.keepAwake state
76 // is changed from within a script, WakeLockService will receive an update 76 // is changed from within a script, mojom::WakeLockService will receive an
77 // update
Tom Sepez 2016/03/25 15:42:27 nit: format
leonhsl(Using Gerrit) 2016/03/26 14:34:30 Done.
77 // request before ExecuteScript() returns. Therefore, some time slack is 78 // request before ExecuteScript() returns. Therefore, some time slack is
78 // needed to make sure that WakeLockService has received any possible update 79 // needed to make sure that mojom::WakeLockService has received any possible
80 // update
79 // requests before checking the resulting wake lock state. 81 // requests before checking the resulting wake lock state.
80 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); 82 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout());
81 RunAllPendingInMessageLoop(); 83 RunAllPendingInMessageLoop();
82 } 84 }
83 85
84 void ScreenWakeLockInMainFrame() { 86 void ScreenWakeLockInMainFrame() {
85 EXPECT_TRUE(ExecuteScript(GetMainFrame(), "screen.keepAwake = true;")); 87 EXPECT_TRUE(ExecuteScript(GetMainFrame(), "screen.keepAwake = true;"));
86 WaitForPossibleUpdate(); 88 WaitForPossibleUpdate();
87 EXPECT_TRUE(HasWakeLock()); 89 EXPECT_TRUE(HasWakeLock());
88 } 90 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 GetNestedFrame()->GetProcess(), 369 GetNestedFrame()->GetProcess(),
368 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 370 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
369 GetNestedFrame()->GetProcess()->Shutdown(0, false); 371 GetNestedFrame()->GetProcess()->Shutdown(0, false);
370 watcher.Wait(); 372 watcher.Wait();
371 373
372 // Screen wake lock should be released. 374 // Screen wake lock should be released.
373 EXPECT_FALSE(HasWakeLock()); 375 EXPECT_FALSE(HasWakeLock());
374 } 376 }
375 377
376 } // namespace content 378 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698