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

Side by Side Diff: ppapi/tests/test_host_resolver_private_disallowed.cc

Issue 11411357: PPB_HostResolver_Private is switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 7 years, 10 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 #include "ppapi/tests/test_host_resolver_private_disallowed.h"
6
7 #include "ppapi/cpp/module.h"
8 #include "ppapi/cpp/private/net_address_private.h"
9 #include "ppapi/tests/test_utils.h"
10 #include "ppapi/tests/testing_instance.h"
11
12 REGISTER_TEST_CASE(HostResolverPrivateDisallowed);
13
14 TestHostResolverPrivateDisallowed::TestHostResolverPrivateDisallowed(
15 TestingInstance* instance)
16 : TestCase(instance) {
17 }
18
19 bool TestHostResolverPrivateDisallowed::Init() {
20 bool host_resolver_private_is_available =
21 pp::HostResolverPrivate::IsAvailable();
22 if (!host_resolver_private_is_available)
23 instance_->AppendError("PPB_HostResolver_Private interface not available");
24
25 bool init_host_port =
26 GetLocalHostPort(instance_->pp_instance(), &host_, &port_);
27 if (!init_host_port)
28 instance_->AppendError("Can't init host and port");
29
30 return host_resolver_private_is_available &&
31 init_host_port &&
32 EnsureRunningOverHTTP();
33 }
34
35 void TestHostResolverPrivateDisallowed::RunTests(const std::string& filter) {
36 RUN_TEST_FORCEASYNC_AND_NOT(Resolve, filter);
37 }
38
39 std::string TestHostResolverPrivateDisallowed::TestResolve() {
40 pp::HostResolverPrivate host_resolver(instance_);
41 PP_HostResolver_Private_Hint hint;
42 hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED;
43 hint.flags = PP_HOST_RESOLVER_FLAGS_CANONNAME;
44 TestCompletionCallback callback(instance_->pp_instance(), force_async_);
45 int32_t rv = host_resolver.Resolve(host_, port_, hint, callback);
46 if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
47 return ReportError("PPB_HostResolver_Private::Resolve force_async", rv);
48 if (rv == PP_OK_COMPLETIONPENDING)
49 rv = callback.WaitForResult();
50 if (rv != PP_ERROR_FAILED)
51 return "PPB_HostResolver_Private can resolve without allowing switch";
52 PASS();
53 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_host_resolver_private_disallowed.h ('k') | ppapi/thunk/interfaces_ppb_private_no_permissions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698