Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
|
Dan Beam
2013/08/12 22:33:52
where else is are these classes used? why does a
Noam Samuel
2013/08/12 23:25:46
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_BROWSERTEST_H _ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_BROWSERTEST_H _ | |
| 7 | |
|
Dan Beam
2013/08/12 22:33:52
base/basictypes.h (for DISALLOW_*)
base/compiler_s
Noam Samuel
2013/08/12 23:25:46
Done.
| |
| 8 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" | |
| 9 #include "chrome/test/base/web_ui_browsertest.h" | |
| 10 | |
| 11 namespace local_discovery { | |
| 12 | |
| 13 class TestMessageLoopCondition { | |
| 14 public: | |
| 15 TestMessageLoopCondition(); | |
| 16 ~TestMessageLoopCondition(); | |
| 17 | |
| 18 void Signal(); | |
| 19 void Wait(); | |
|
Dan Beam
2013/08/12 22:33:52
nit: \n
Noam Samuel
2013/08/12 23:25:46
Done.
Noam Samuel
2013/08/12 23:25:46
Done.
| |
| 20 private: | |
| 21 bool set_; | |
| 22 bool waiting_; | |
|
Dan Beam
2013/08/12 22:33:52
DISALLOW_COPY_AND_ASSIGN() on all relevant classes
Noam Samuel
2013/08/12 23:25:46
Done.
| |
| 23 }; | |
| 24 | |
| 25 class FakePrivetDeviceLister : public PrivetDeviceLister { | |
| 26 public: | |
| 27 explicit FakePrivetDeviceLister(base::Closure discover_devices_called); | |
| 28 virtual ~FakePrivetDeviceLister(); | |
| 29 | |
| 30 virtual void Start() OVERRIDE; | |
| 31 | |
| 32 virtual void DiscoverNewDevices(bool force_referesh) OVERRIDE; | |
| 33 | |
| 34 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | |
| 35 Delegate* delegate() { return delegate_; } | |
| 36 private: | |
| 37 Delegate* delegate_; | |
| 38 base::Closure discover_devices_called_; | |
| 39 }; | |
| 40 | |
| 41 class FakeLocalDiscoveryUIFactory : public LocalDiscoveryUIHandler::Factory { | |
| 42 public: | |
| 43 explicit FakeLocalDiscoveryUIFactory( | |
| 44 scoped_ptr<FakePrivetDeviceLister> privet_lister); | |
| 45 | |
| 46 virtual ~FakeLocalDiscoveryUIFactory(); | |
| 47 | |
| 48 virtual LocalDiscoveryUIHandler* CreateLocalDiscoveryUIHandler() OVERRIDE; | |
| 49 | |
| 50 FakePrivetDeviceLister* privet_lister() { return privet_lister_; } | |
| 51 private: | |
| 52 scoped_ptr<FakePrivetDeviceLister> owned_privet_lister_; | |
| 53 FakePrivetDeviceLister* privet_lister_; | |
|
Dan Beam
2013/08/12 22:33:52
^ denote ownership model differences and how |owne
Noam Samuel
2013/08/12 23:25:46
Done.
| |
| 54 }; | |
| 55 | |
| 56 | |
| 57 class LocalDiscoveryUITest : public WebUIBrowserTest { | |
| 58 public: | |
| 59 LocalDiscoveryUITest(); | |
| 60 virtual ~LocalDiscoveryUITest(); | |
| 61 | |
| 62 virtual void SetUpOnMainThread() OVERRIDE; | |
| 63 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 64 | |
| 65 protected: | |
| 66 scoped_ptr<FakeLocalDiscoveryUIFactory> ui_factory_; | |
| 67 TestMessageLoopCondition condition_devices_listed_; | |
|
Dan Beam
2013/08/12 22:33:52
private with accessors
Noam Samuel
2013/08/12 23:25:46
Done.
| |
| 68 }; | |
| 69 | |
| 70 } // namespace local_discovery | |
| 71 | |
| 72 #endif // CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_BROWSERTES T_H_ | |
| OLD | NEW |