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

Side by Side Diff: content/browser/vibration_manager_integration_browsertest.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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 <stdint.h>
6
7 #include "base/macros.h"
8 #include "build/build_config.h"
5 #include "content/public/browser/content_browser_client.h" 9 #include "content/public/browser/content_browser_client.h"
6 #include "content/public/common/service_registry.h" 10 #include "content/public/common/service_registry.h"
7 #include "content/public/test/content_browser_test.h" 11 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h" 12 #include "content/public/test/content_browser_test_utils.h"
9 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
10 #include "content/shell/browser/shell.h" 14 #include "content/shell/browser/shell.h"
11 #include "content/shell/browser/shell_content_browser_client.h" 15 #include "content/shell/browser/shell_content_browser_client.h"
12 #include "device/vibration/vibration_manager.mojom.h" 16 #include "device/vibration/vibration_manager.mojom.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h" 17 #include "mojo/public/cpp/bindings/strong_binding.h"
14 18
15 // These tests run against a dummy implementation of the VibrationManager 19 // These tests run against a dummy implementation of the VibrationManager
16 // service. That is, they verify that the service implementation is correctly 20 // service. That is, they verify that the service implementation is correctly
17 // exposed to the renderer, whatever the implementation is. 21 // exposed to the renderer, whatever the implementation is.
18 22
19 namespace content { 23 namespace content {
20 24
21 namespace { 25 namespace {
22 26
23 // Global, record milliseconds when Vibrate() got called. 27 // Global, record milliseconds when Vibrate() got called.
24 int64 g_vibrate_milliseconds; 28 int64_t g_vibrate_milliseconds;
25 // Global, record whether Cancel() got called. 29 // Global, record whether Cancel() got called.
26 bool g_cancelled; 30 bool g_cancelled;
27 // Global, wait for end of execution for VibrationManager API Vibrate(). 31 // Global, wait for end of execution for VibrationManager API Vibrate().
28 scoped_refptr<content::MessageLoopRunner> g_wait_vibrate_runner; 32 scoped_refptr<content::MessageLoopRunner> g_wait_vibrate_runner;
29 // Global, wait for end of execution for VibrationManager API Cancel(). 33 // Global, wait for end of execution for VibrationManager API Cancel().
30 scoped_refptr<content::MessageLoopRunner> g_wait_cancel_runner; 34 scoped_refptr<content::MessageLoopRunner> g_wait_cancel_runner;
31 35
32 void ResetGlobalValues() { 36 void ResetGlobalValues() {
33 g_vibrate_milliseconds = -1; 37 g_vibrate_milliseconds = -1;
34 g_cancelled = false; 38 g_cancelled = false;
35 39
36 g_wait_vibrate_runner = new content::MessageLoopRunner(); 40 g_wait_vibrate_runner = new content::MessageLoopRunner();
37 g_wait_cancel_runner = new content::MessageLoopRunner(); 41 g_wait_cancel_runner = new content::MessageLoopRunner();
38 } 42 }
39 43
40 class FakeVibrationManager : public device::VibrationManager { 44 class FakeVibrationManager : public device::VibrationManager {
41 public: 45 public:
42 static void Create(mojo::InterfaceRequest<VibrationManager> request) { 46 static void Create(mojo::InterfaceRequest<VibrationManager> request) {
43 new FakeVibrationManager(request.Pass()); 47 new FakeVibrationManager(request.Pass());
44 } 48 }
45 49
46 private: 50 private:
47 FakeVibrationManager(mojo::InterfaceRequest<VibrationManager> request) 51 FakeVibrationManager(mojo::InterfaceRequest<VibrationManager> request)
48 : binding_(this, request.Pass()) {} 52 : binding_(this, request.Pass()) {}
49 ~FakeVibrationManager() override {} 53 ~FakeVibrationManager() override {}
50 54
51 void Vibrate(int64 milliseconds) override { 55 void Vibrate(int64_t milliseconds) override {
52 g_vibrate_milliseconds = milliseconds; 56 g_vibrate_milliseconds = milliseconds;
53 g_wait_vibrate_runner->Quit(); 57 g_wait_vibrate_runner->Quit();
54 } 58 }
55 59
56 void Cancel() override { 60 void Cancel() override {
57 g_cancelled = true; 61 g_cancelled = true;
58 g_wait_cancel_runner->Quit(); 62 g_wait_cancel_runner->Quit();
59 } 63 }
60 64
61 mojo::StrongBinding<VibrationManager> binding_; 65 mojo::StrongBinding<VibrationManager> binding_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 shell()->LoadURL(test_url); 130 shell()->LoadURL(test_url);
127 // Wait until VibrationManager::Cancel() got called. 131 // Wait until VibrationManager::Cancel() got called.
128 g_wait_cancel_runner->Run(); 132 g_wait_cancel_runner->Run();
129 133
130 EXPECT_TRUE(g_cancelled); 134 EXPECT_TRUE(g_cancelled);
131 } 135 }
132 136
133 } // namespace 137 } // namespace
134 138
135 } // namespace content 139 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/utility_process_host_impl.cc ('k') | content/browser/vr/android/cardboard/cardboard_vr_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698