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

Side by Side Diff: content/shell/browser/layout_test/layout_test_browser_context.cc

Issue 1132943002: bluetooth: Move mock creation out of BluetoothDispatcherHost to LayoutTestBluetoothAdapterProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-testing-layout-tests
Patch Set: Changed new'ed variables to scoped_ptr. Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/shell/browser/layout_test/layout_test_browser_context.h" 5 #include "content/shell/browser/layout_test/layout_test_browser_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/push_messaging_service.h" 12 #include "content/public/browser/push_messaging_service.h"
13 #include "content/public/browser/resource_context.h" 13 #include "content/public/browser/resource_context.h"
14 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h"
14 #include "content/shell/browser/layout_test/layout_test_download_manager_delegat e.h" 15 #include "content/shell/browser/layout_test/layout_test_download_manager_delegat e.h"
15 #include "content/shell/browser/layout_test/layout_test_permission_manager.h" 16 #include "content/shell/browser/layout_test/layout_test_permission_manager.h"
16 #include "content/shell/browser/layout_test/layout_test_push_messaging_service.h " 17 #include "content/shell/browser/layout_test/layout_test_push_messaging_service.h "
17 #include "content/shell/browser/layout_test/layout_test_url_request_context_gett er.h" 18 #include "content/shell/browser/layout_test/layout_test_url_request_context_gett er.h"
18 #include "content/shell/browser/shell_url_request_context_getter.h" 19 #include "content/shell/browser/shell_url_request_context_getter.h"
19 20
20 #if defined(OS_WIN) 21 #if defined(OS_WIN)
21 #include "base/base_paths_win.h" 22 #include "base/base_paths_win.h"
22 #elif defined(OS_LINUX) 23 #elif defined(OS_LINUX)
23 #include "base/nix/xdg_util.h" 24 #include "base/nix/xdg_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 GetPath().Append(FILE_PATH_LITERAL("downloads"))); 61 GetPath().Append(FILE_PATH_LITERAL("downloads")));
61 } 62 }
62 63
63 return download_manager_delegate_.get(); 64 return download_manager_delegate_.get();
64 } 65 }
65 66
66 void LayoutTestBrowserContext::GetBluetoothAdapterForTesting( 67 void LayoutTestBrowserContext::GetBluetoothAdapterForTesting(
67 const std::string& fake_adapter_name, 68 const std::string& fake_adapter_name,
68 const base::Callback<void(scoped_refptr<device::BluetoothAdapter> adapter)>& 69 const base::Callback<void(scoped_refptr<device::BluetoothAdapter> adapter)>&
69 callback) { 70 callback) {
70 // TODO(ortuno): Get mock data. 71 if (!bluetooth_adapter_provider_)
72 bluetooth_adapter_provider_.reset(new LayoutTestBluetoothAdapterProvider());
73 bluetooth_adapter_provider_->GetBluetoothAdapter(fake_adapter_name, callback);
71 } 74 }
72 75
73 PushMessagingService* LayoutTestBrowserContext::GetPushMessagingService() { 76 PushMessagingService* LayoutTestBrowserContext::GetPushMessagingService() {
74 if (!push_messaging_service_) 77 if (!push_messaging_service_)
75 push_messaging_service_.reset(new LayoutTestPushMessagingService()); 78 push_messaging_service_.reset(new LayoutTestPushMessagingService());
76 return push_messaging_service_.get(); 79 return push_messaging_service_.get();
77 } 80 }
78 81
79 PermissionManager* LayoutTestBrowserContext::GetPermissionManager() { 82 PermissionManager* LayoutTestBrowserContext::GetPermissionManager() {
80 if (!permission_manager_.get()) 83 if (!permission_manager_.get())
81 permission_manager_.reset(new LayoutTestPermissionManager()); 84 permission_manager_.reset(new LayoutTestPermissionManager());
82 return permission_manager_.get(); 85 return permission_manager_.get();
83 } 86 }
84 87
85 LayoutTestPermissionManager* 88 LayoutTestPermissionManager*
86 LayoutTestBrowserContext::GetLayoutTestPermissionManager() { 89 LayoutTestBrowserContext::GetLayoutTestPermissionManager() {
87 return static_cast<LayoutTestPermissionManager*>(GetPermissionManager()); 90 return static_cast<LayoutTestPermissionManager*>(GetPermissionManager());
88 } 91 }
89 92
90 } // namespace content 93 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698