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

Side by Side Diff: chrome/browser/extensions/api/dns/dns_apitest.cc

Issue 529293003: Extract ResultCatcher from ExtensionApiTest. Use it in ShellApiTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: deprecate Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_apitest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/memory/ref_counted.h"
6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "extensions/browser/api/dns/host_resolver_wrapper.h"
8 #include "extensions/browser/api/dns/mock_host_resolver_creator.h"
9 #include "net/dns/mock_host_resolver.h"
10
11 class DnsApiTest : public ExtensionApiTest {
12 public:
13 DnsApiTest() : resolver_creator_(new extensions::MockHostResolverCreator()) {}
14
15 private:
16 virtual void SetUpOnMainThread() OVERRIDE {
17 ExtensionApiTest::SetUpOnMainThread();
18 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting(
19 resolver_creator_->CreateMockHostResolver());
20 }
21
22 virtual void TearDownOnMainThread() OVERRIDE {
23 extensions::HostResolverWrapper::GetInstance()->
24 SetHostResolverForTesting(NULL);
25 resolver_creator_->DeleteMockHostResolver();
26 ExtensionApiTest::TearDownOnMainThread();
27 }
28
29 // The MockHostResolver asserts that it's used on the same thread on which
30 // it's created, which is actually a stronger rule than its real counterpart.
31 // But that's fine; it's good practice.
32 scoped_refptr<extensions::MockHostResolverCreator> resolver_creator_;
33 };
34
35 IN_PROC_BROWSER_TEST_F(DnsApiTest, DnsExtension) {
36 ASSERT_TRUE(RunExtensionTest("dns/api")) << message_;
37 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_apitest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698