OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/extensions/api/mdns/mdns_api.h" | 5 #include "chrome/browser/extensions/api/mdns/mdns_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/values.h" | |
15 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/extension_service_test_base.h" | 15 #include "chrome/browser/extensions/extension_service_test_base.h" |
17 #include "chrome/browser/extensions/test_extension_system.h" | 16 #include "chrome/browser/extensions/test_extension_system.h" |
18 #include "chrome/common/extensions/api/mdns.h" | 17 #include "chrome/common/extensions/api/mdns.h" |
19 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
20 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
21 #include "extensions/browser/event_listener_map.h" | 20 #include "extensions/browser/event_listener_map.h" |
22 #include "extensions/browser/event_router_factory.h" | 21 #include "extensions/browser/event_router_factory.h" |
23 #include "extensions/browser/extension_prefs.h" | 22 #include "extensions/browser/extension_prefs.h" |
24 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 std::string name, | 238 std::string name, |
240 bool is_platform_app, | 239 bool is_platform_app, |
241 std::string extension_id) { | 240 std::string extension_id) { |
242 base::DictionaryValue manifest; | 241 base::DictionaryValue manifest; |
243 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); | 242 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); |
244 manifest.SetString(extensions::manifest_keys::kName, name); | 243 manifest.SetString(extensions::manifest_keys::kName, name); |
245 if (is_platform_app) { | 244 if (is_platform_app) { |
246 // Setting app.background.page = "background.html" is sufficient to make | 245 // Setting app.background.page = "background.html" is sufficient to make |
247 // the extension type TYPE_PLATFORM_APP. | 246 // the extension type TYPE_PLATFORM_APP. |
248 manifest.Set(extensions::manifest_keys::kPlatformAppBackgroundPage, | 247 manifest.Set(extensions::manifest_keys::kPlatformAppBackgroundPage, |
249 base::MakeUnique<base::Value>("background.html")); | 248 new base::Value("background.html")); |
250 } | 249 } |
251 | 250 |
252 std::string error; | 251 std::string error; |
253 return extensions::Extension::Create( | 252 return extensions::Extension::Create( |
254 bogus_file_pathname(name), | 253 bogus_file_pathname(name), |
255 extensions::Manifest::INVALID_LOCATION, | 254 extensions::Manifest::INVALID_LOCATION, |
256 manifest, | 255 manifest, |
257 Extension::NO_FLAGS, | 256 Extension::NO_FLAGS, |
258 extension_id, | 257 extension_id, |
259 &error); | 258 &error); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 render_process_host(), kExtId, filter, false); | 436 render_process_host(), kExtId, filter, false); |
438 | 437 |
439 EXPECT_CALL(*dns_sd_registry(), UnregisterDnsSdListener("_trex._tcp.local")); | 438 EXPECT_CALL(*dns_sd_registry(), UnregisterDnsSdListener("_trex._tcp.local")); |
440 EventRouter::Get(browser_context()) | 439 EventRouter::Get(browser_context()) |
441 ->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName, | 440 ->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName, |
442 render_process_host(), kExtId, filter, | 441 render_process_host(), kExtId, filter, |
443 false); | 442 false); |
444 } | 443 } |
445 | 444 |
446 } // namespace extensions | 445 } // namespace extensions |
OLD | NEW |