Chromium Code Reviews| Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.h |
| diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.h b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2765d377a38e603038a078744b5156d0c3190124 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.h |
| @@ -0,0 +1,72 @@ |
| +// 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.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_BROWSERTEST_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_BROWSERTEST_H_ |
| + |
|
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.
|
| +#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
| +#include "chrome/test/base/web_ui_browsertest.h" |
| + |
| +namespace local_discovery { |
| + |
| +class TestMessageLoopCondition { |
| + public: |
| + TestMessageLoopCondition(); |
| + ~TestMessageLoopCondition(); |
| + |
| + void Signal(); |
| + 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.
|
| + private: |
| + bool set_; |
| + 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.
|
| +}; |
| + |
| +class FakePrivetDeviceLister : public PrivetDeviceLister { |
| + public: |
| + explicit FakePrivetDeviceLister(base::Closure discover_devices_called); |
| + virtual ~FakePrivetDeviceLister(); |
| + |
| + virtual void Start() OVERRIDE; |
| + |
| + virtual void DiscoverNewDevices(bool force_referesh) OVERRIDE; |
| + |
| + void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| + Delegate* delegate() { return delegate_; } |
| + private: |
| + Delegate* delegate_; |
| + base::Closure discover_devices_called_; |
| +}; |
| + |
| +class FakeLocalDiscoveryUIFactory : public LocalDiscoveryUIHandler::Factory { |
| + public: |
| + explicit FakeLocalDiscoveryUIFactory( |
| + scoped_ptr<FakePrivetDeviceLister> privet_lister); |
| + |
| + virtual ~FakeLocalDiscoveryUIFactory(); |
| + |
| + virtual LocalDiscoveryUIHandler* CreateLocalDiscoveryUIHandler() OVERRIDE; |
| + |
| + FakePrivetDeviceLister* privet_lister() { return privet_lister_; } |
| + private: |
| + scoped_ptr<FakePrivetDeviceLister> owned_privet_lister_; |
| + 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.
|
| +}; |
| + |
| + |
| +class LocalDiscoveryUITest : public WebUIBrowserTest { |
| + public: |
| + LocalDiscoveryUITest(); |
| + virtual ~LocalDiscoveryUITest(); |
| + |
| + virtual void SetUpOnMainThread() OVERRIDE; |
| + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| + |
| + protected: |
| + scoped_ptr<FakeLocalDiscoveryUIFactory> ui_factory_; |
| + TestMessageLoopCondition condition_devices_listed_; |
|
Dan Beam
2013/08/12 22:33:52
private with accessors
Noam Samuel
2013/08/12 23:25:46
Done.
|
| +}; |
| + |
| +} // namespace local_discovery |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_LOCAL_DISCOVERY_LOCAL_DISCOVERY_UI_BROWSERTEST_H_ |