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 } |
477 void FetchRequest(URLRequestPtr request, | 487 void FetchRequest(URLRequestPtr request, |
478 const Fetcher::FetchCallback& loader_callback) override { | 488 const Fetcher::FetchCallback& loader_callback) override { |
479 if (create_test_fetcher_) | 489 if (create_test_fetcher_) |
480 new TestMimeTypeFetcher(loader_callback, fetcher_url_, mime_type_); | 490 new TestMimeTypeFetcher(loader_callback, fetcher_url_, mime_type_); |
481 } | 491 } |
482 | 492 |
483 private: | 493 private: |
484 bool create_test_fetcher_; | 494 bool create_test_fetcher_; |
485 GURL fetcher_url_; | 495 GURL fetcher_url_; |
486 std::string mime_type_; | 496 std::string mime_type_; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 params->set_filter(GetPermissiveCapabilityFilter()); | 915 params->set_filter(GetPermissiveCapabilityFilter()); |
906 params->set_connect_callback( | 916 params->set_connect_callback( |
907 [&content_handler_id](uint32_t t) { content_handler_id = t; }); | 917 [&content_handler_id](uint32_t t) { content_handler_id = t; }); |
908 application_manager_->ConnectToApplication(params.Pass()); | 918 application_manager_->ConnectToApplication(params.Pass()); |
909 EXPECT_EQ(0u, content_handler_id); | 919 EXPECT_EQ(0u, content_handler_id); |
910 } | 920 } |
911 | 921 |
912 } // namespace | 922 } // namespace |
913 } // namespace shell | 923 } // namespace shell |
914 } // namespace mojo | 924 } // namespace mojo |
OLD | NEW |