OLD | NEW |
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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 void set_create_test_fetcher(bool create_test_fetcher) { | 468 void set_create_test_fetcher(bool create_test_fetcher) { |
469 create_test_fetcher_ = create_test_fetcher; | 469 create_test_fetcher_ = create_test_fetcher; |
470 } | 470 } |
471 | 471 |
472 void set_fetcher_url(const GURL& url) { fetcher_url_ = url; } | 472 void set_fetcher_url(const GURL& url) { fetcher_url_ = url; } |
473 | 473 |
474 void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; } | 474 void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; } |
475 | 475 |
476 // TestPackageManager: | 476 // TestPackageManager: |
477 GURL ResolveURL(const GURL& url) override { | |
478 GURL resolved_url = url; | |
479 // The shell automatically map mojo URLs. | |
480 if (resolved_url.scheme() == "mojo") { | |
481 url::Replacements<char> replacements; | |
482 replacements.SetScheme("file", url::Component(0, 4)); | |
483 resolved_url = resolved_url.ReplaceComponents(replacements); | |
484 } | |
485 return resolved_url; | |
486 } | |
487 void FetchRequest(URLRequestPtr request, | 477 void FetchRequest(URLRequestPtr request, |
488 const Fetcher::FetchCallback& loader_callback) override { | 478 const Fetcher::FetchCallback& loader_callback) override { |
489 if (create_test_fetcher_) | 479 if (create_test_fetcher_) |
490 new TestMimeTypeFetcher(loader_callback, fetcher_url_, mime_type_); | 480 new TestMimeTypeFetcher(loader_callback, fetcher_url_, mime_type_); |
491 } | 481 } |
492 | 482 |
493 private: | 483 private: |
494 bool create_test_fetcher_; | 484 bool create_test_fetcher_; |
495 GURL fetcher_url_; | 485 GURL fetcher_url_; |
496 std::string mime_type_; | 486 std::string mime_type_; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 params->set_filter(GetPermissiveCapabilityFilter()); | 905 params->set_filter(GetPermissiveCapabilityFilter()); |
916 params->set_connect_callback( | 906 params->set_connect_callback( |
917 [&content_handler_id](uint32_t t) { content_handler_id = t; }); | 907 [&content_handler_id](uint32_t t) { content_handler_id = t; }); |
918 application_manager_->ConnectToApplication(params.Pass()); | 908 application_manager_->ConnectToApplication(params.Pass()); |
919 EXPECT_EQ(0u, content_handler_id); | 909 EXPECT_EQ(0u, content_handler_id); |
920 } | 910 } |
921 | 911 |
922 } // namespace | 912 } // namespace |
923 } // namespace shell | 913 } // namespace shell |
924 } // namespace mojo | 914 } // namespace mojo |
OLD | NEW |