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

Side by Side Diff: chrome/browser/extensions/api/dns/mock_host_resolver_creator.h

Issue 10537017: Allow hostnames in socket.connect(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mihaip's comments + clang fix. Created 8 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DNS_MOCK_HOST_RESOLVER_CREATOR_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DNS_MOCK_HOST_RESOLVER_CREATOR_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/synchronization/waitable_event.h"
13
14 namespace net {
15 class MockHostResolver;
16 }
17
18 namespace extensions {
19
20 // Used only for testing. Creates a MockHostResolver, respecting threading
21 // constraints.
22 class MockHostResolverCreator
23 : public base::RefCountedThreadSafe<MockHostResolverCreator> {
24 public:
25 static const std::string kHostname;
26 static const std::string kAddress;
27
28 MockHostResolverCreator();
29
30 net::MockHostResolver* CreateMockHostResolver();
31 void DeleteMockHostResolver();
32
33 private:
34 friend class base::RefCountedThreadSafe<MockHostResolverCreator>;
35 virtual ~MockHostResolverCreator();
36
37 void CreateMockHostResolverOnIOThread();
38 void DeleteMockHostResolverOnIOThread();
39
40 base::WaitableEvent resolver_event_;
41
42 // The MockHostResolver asserts that it's used on the same thread on which
43 // it's created, which is actually a stronger rule than its real counterpart.
44 // But that's fine; it's good practice.
45 //
46 // Plain pointer because we have to manage lifetime manually.
47 net::MockHostResolver* mock_host_resolver_;
48 };
49
50 } // namespace extensions
51
52 #endif // CHROME_BROWSER_EXTENSIONS_API_DNS_MOCK_HOST_RESOLVER_CREATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698