OLD | NEW |
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> | 5 #include <stdint.h> |
| 6 #include <utility> |
6 | 7 |
7 #include "base/macros.h" | 8 #include "base/macros.h" |
8 #include "build/build_config.h" | 9 #include "build/build_config.h" |
9 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
10 #include "content/public/common/service_registry.h" | 11 #include "content/public/common/service_registry.h" |
11 #include "content/public/test/content_browser_test.h" | 12 #include "content/public/test/content_browser_test.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 13 #include "content/public/test/content_browser_test_utils.h" |
13 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
14 #include "content/shell/browser/shell.h" | 15 #include "content/shell/browser/shell.h" |
15 #include "content/shell/browser/shell_content_browser_client.h" | 16 #include "content/shell/browser/shell_content_browser_client.h" |
(...skipping 21 matching lines...) Expand all Loading... |
37 g_vibrate_milliseconds = -1; | 38 g_vibrate_milliseconds = -1; |
38 g_cancelled = false; | 39 g_cancelled = false; |
39 | 40 |
40 g_wait_vibrate_runner = new content::MessageLoopRunner(); | 41 g_wait_vibrate_runner = new content::MessageLoopRunner(); |
41 g_wait_cancel_runner = new content::MessageLoopRunner(); | 42 g_wait_cancel_runner = new content::MessageLoopRunner(); |
42 } | 43 } |
43 | 44 |
44 class FakeVibrationManager : public device::VibrationManager { | 45 class FakeVibrationManager : public device::VibrationManager { |
45 public: | 46 public: |
46 static void Create(mojo::InterfaceRequest<VibrationManager> request) { | 47 static void Create(mojo::InterfaceRequest<VibrationManager> request) { |
47 new FakeVibrationManager(request.Pass()); | 48 new FakeVibrationManager(std::move(request)); |
48 } | 49 } |
49 | 50 |
50 private: | 51 private: |
51 FakeVibrationManager(mojo::InterfaceRequest<VibrationManager> request) | 52 FakeVibrationManager(mojo::InterfaceRequest<VibrationManager> request) |
52 : binding_(this, request.Pass()) {} | 53 : binding_(this, std::move(request)) {} |
53 ~FakeVibrationManager() override {} | 54 ~FakeVibrationManager() override {} |
54 | 55 |
55 void Vibrate(int64_t milliseconds) override { | 56 void Vibrate(int64_t milliseconds) override { |
56 g_vibrate_milliseconds = milliseconds; | 57 g_vibrate_milliseconds = milliseconds; |
57 g_wait_vibrate_runner->Quit(); | 58 g_wait_vibrate_runner->Quit(); |
58 } | 59 } |
59 | 60 |
60 void Cancel() override { | 61 void Cancel() override { |
61 g_cancelled = true; | 62 g_cancelled = true; |
62 g_wait_cancel_runner->Quit(); | 63 g_wait_cancel_runner->Quit(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 shell()->LoadURL(test_url); | 131 shell()->LoadURL(test_url); |
131 // Wait until VibrationManager::Cancel() got called. | 132 // Wait until VibrationManager::Cancel() got called. |
132 g_wait_cancel_runner->Run(); | 133 g_wait_cancel_runner->Run(); |
133 | 134 |
134 EXPECT_TRUE(g_cancelled); | 135 EXPECT_TRUE(g_cancelled); |
135 } | 136 } |
136 | 137 |
137 } // namespace | 138 } // namespace |
138 | 139 |
139 } // namespace content | 140 } // namespace content |
OLD | NEW |