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

Side by Side Diff: chrome/browser/extensions/api/socket/socket_apitest.cc

Issue 12494028: Move Requirements out of Extension Class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h" 7 #include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h"
8 #include "chrome/browser/extensions/api/dns/mock_host_resolver_creator.h" 8 #include "chrome/browser/extensions/api/dns/mock_host_resolver_creator.h"
9 #include "chrome/browser/extensions/api/socket/socket_api.h" 9 #include "chrome/browser/extensions/api/socket/socket_api.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 25 matching lines...) Expand all
36 36
37 // We need this while the socket.{listen,accept} methods require the 37 // We need this while the socket.{listen,accept} methods require the
38 // enable-experimental-extension-apis flag. After that we should remove it, 38 // enable-experimental-extension-apis flag. After that we should remove it,
39 // as well as the "experimental" permission in the test apps' manifests. 39 // as well as the "experimental" permission in the test apps' manifests.
40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
41 ExtensionApiTest::SetUpCommandLine(command_line); 41 ExtensionApiTest::SetUpCommandLine(command_line);
42 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 42 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
43 } 43 }
44 44
45 virtual void SetUpOnMainThread() OVERRIDE { 45 virtual void SetUpOnMainThread() OVERRIDE {
46 ExtensionApiTest::SetUpOnMainThread();
46 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting( 47 extensions::HostResolverWrapper::GetInstance()->SetHostResolverForTesting(
47 resolver_creator_->CreateMockHostResolver()); 48 resolver_creator_->CreateMockHostResolver());
48 } 49 }
49 50
50 virtual void CleanUpOnMainThread() OVERRIDE { 51 virtual void CleanUpOnMainThread() OVERRIDE {
51 extensions::HostResolverWrapper::GetInstance()-> 52 extensions::HostResolverWrapper::GetInstance()->
52 SetHostResolverForTesting(NULL); 53 SetHostResolverForTesting(NULL);
53 resolver_creator_->DeleteMockHostResolver(); 54 resolver_creator_->DeleteMockHostResolver();
55 ExtensionApiTest::CleanUpOnMainThread();
54 } 56 }
55 57
56 private: 58 private:
57 base::WaitableEvent resolver_event_; 59 base::WaitableEvent resolver_event_;
58 60
59 // The MockHostResolver asserts that it's used on the same thread on which 61 // The MockHostResolver asserts that it's used on the same thread on which
60 // it's created, which is actually a stronger rule than its real counterpart. 62 // it's created, which is actually a stronger rule than its real counterpart.
61 // But that's fine; it's good practice. 63 // But that's fine; it's good practice.
62 scoped_refptr<extensions::MockHostResolverCreator> resolver_creator_; 64 scoped_refptr<extensions::MockHostResolverCreator> resolver_creator_;
63 }; 65 };
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 LoadExtension(test_data_dir_.AppendASCII("socket/unload")); 194 LoadExtension(test_data_dir_.AppendASCII("socket/unload"));
193 ASSERT_TRUE(extension); 195 ASSERT_TRUE(extension);
194 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 196 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
195 197
196 UnloadExtension(extension->id()); 198 UnloadExtension(extension->id());
197 199
198 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/unload"))) 200 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/unload")))
199 << message_; 201 << message_;
200 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 202 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
201 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698