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

Side by Side Diff: content/browser/gamepad/gamepad_test_helpers.h

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 DISALLOW_COPY_AND_ASSIGN(MockGamepadDataFetcher); 44 DISALLOW_COPY_AND_ASSIGN(MockGamepadDataFetcher);
45 }; 45 };
46 46
47 // Base class for the other test helpers. This just sets up the system monitor. 47 // Base class for the other test helpers. This just sets up the system monitor.
48 class GamepadTestHelper { 48 class GamepadTestHelper {
49 public: 49 public:
50 GamepadTestHelper(); 50 GamepadTestHelper();
51 virtual ~GamepadTestHelper(); 51 virtual ~GamepadTestHelper();
52 52
53 MessageLoop& message_loop() { return message_loop_; } 53 base::MessageLoop& message_loop() { return message_loop_; }
54 54
55 private: 55 private:
56 // This must be constructed before the system monitor. 56 // This must be constructed before the system monitor.
57 MessageLoop message_loop_; 57 base::MessageLoop message_loop_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper); 59 DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper);
60 }; 60 };
61 61
62 // Constructs a GamepadService with a mock data source. This bypasses the 62 // Constructs a GamepadService with a mock data source. This bypasses the
63 // global singleton for the gamepad service. 63 // global singleton for the gamepad service.
64 class GamepadServiceTestConstructor : public GamepadTestHelper { 64 class GamepadServiceTestConstructor : public GamepadTestHelper {
65 public: 65 public:
66 explicit GamepadServiceTestConstructor(const WebKit::WebGamepads& test_data); 66 explicit GamepadServiceTestConstructor(const WebKit::WebGamepads& test_data);
67 virtual ~GamepadServiceTestConstructor(); 67 virtual ~GamepadServiceTestConstructor();
68 68
69 GamepadService* gamepad_service() { return gamepad_service_; } 69 GamepadService* gamepad_service() { return gamepad_service_; }
70 MockGamepadDataFetcher* data_fetcher() { return data_fetcher_; } 70 MockGamepadDataFetcher* data_fetcher() { return data_fetcher_; }
71 71
72 private: 72 private:
73 // Owning pointer (can't be a scoped_ptr due to private destructor). 73 // Owning pointer (can't be a scoped_ptr due to private destructor).
74 GamepadService* gamepad_service_; 74 GamepadService* gamepad_service_;
75 75
76 // Pointer owned by the provider (which is owned by the gamepad service). 76 // Pointer owned by the provider (which is owned by the gamepad service).
77 MockGamepadDataFetcher* data_fetcher_; 77 MockGamepadDataFetcher* data_fetcher_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(GamepadServiceTestConstructor); 79 DISALLOW_COPY_AND_ASSIGN(GamepadServiceTestConstructor);
80 }; 80 };
81 81
82 } // namespace content 82 } // namespace content
83 83
84 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ 84 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_provider.cc ('k') | content/browser/geolocation/core_location_data_provider_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698