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

Side by Side Diff: mojo/shell/application_manager_unittest.cc

Issue 1228743002: Mandoline: Move ContentHandlerConnection into separate file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 5 years, 5 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
« no previous file with comments | « mojo/shell/application_manager.cc ('k') | mojo/shell/content_handler_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 "mojo/application/public/cpp/application_connection.h" 10 #include "mojo/application/public/cpp/application_connection.h"
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 766
767 TEST_F(ApplicationManagerTest, TestEndApplicationClosure) { 767 TEST_F(ApplicationManagerTest, TestEndApplicationClosure) {
768 ClosingApplicationLoader* loader = new ClosingApplicationLoader(); 768 ClosingApplicationLoader* loader = new ClosingApplicationLoader();
769 application_manager_->SetLoaderForScheme( 769 application_manager_->SetLoaderForScheme(
770 scoped_ptr<ApplicationLoader>(loader), "test"); 770 scoped_ptr<ApplicationLoader>(loader), "test");
771 771
772 bool called = false; 772 bool called = false;
773 mojo::URLRequestPtr request(mojo::URLRequest::New()); 773 mojo::URLRequestPtr request(mojo::URLRequest::New());
774 request->url = mojo::String::From("test:test"); 774 request->url = mojo::String::From("test:test");
775 application_manager_->ConnectToApplication( 775 application_manager_->ConnectToApplication(
776 request.Pass(), GURL(), nullptr, nullptr, 776 request.Pass(), std::string(), GURL(), nullptr, nullptr,
777 base::Bind(&QuitClosure, base::Unretained(&called))); 777 base::Bind(&QuitClosure, base::Unretained(&called)));
778 loop_.Run(); 778 loop_.Run();
779 EXPECT_TRUE(called); 779 EXPECT_TRUE(called);
780 } 780 }
781 781
782 TEST(ApplicationManagerTest2, ContentHandlerConnectionGetsRequestorURL) { 782 TEST(ApplicationManagerTest2, ContentHandlerConnectionGetsRequestorURL) {
783 const GURL content_handler_url("http://test.content.handler"); 783 const GURL content_handler_url("http://test.content.handler");
784 const GURL requestor_url("http://requestor.url"); 784 const GURL requestor_url("http://requestor.url");
785 TestContext test_context; 785 TestContext test_context;
786 base::MessageLoop loop; 786 base::MessageLoop loop;
787 TestDelegate test_delegate; 787 TestDelegate test_delegate;
788 test_delegate.set_create_test_fetcher(true); 788 test_delegate.set_create_test_fetcher(true);
789 ApplicationManager application_manager(&test_delegate); 789 ApplicationManager application_manager(&test_delegate);
790 application_manager.set_default_loader(nullptr); 790 application_manager.set_default_loader(nullptr);
791 application_manager.RegisterContentHandler(kTestMimeType, 791 application_manager.RegisterContentHandler(kTestMimeType,
792 content_handler_url); 792 content_handler_url);
793 793
794 TestApplicationLoader* loader = new TestApplicationLoader; 794 TestApplicationLoader* loader = new TestApplicationLoader;
795 loader->set_context(&test_context); 795 loader->set_context(&test_context);
796 application_manager.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), 796 application_manager.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader),
797 content_handler_url); 797 content_handler_url);
798 798
799 bool called = false; 799 bool called = false;
800 mojo::URLRequestPtr request(mojo::URLRequest::New()); 800 mojo::URLRequestPtr request(mojo::URLRequest::New());
801 request->url = mojo::String::From("test:test"); 801 request->url = mojo::String::From("test:test");
802 application_manager.ConnectToApplication( 802 application_manager.ConnectToApplication(
803 request.Pass(), requestor_url, nullptr, nullptr, 803 request.Pass(), std::string(), requestor_url, nullptr, nullptr,
804 base::Bind(&QuitClosure, base::Unretained(&called))); 804 base::Bind(&QuitClosure, base::Unretained(&called)));
805 loop.Run(); 805 loop.Run();
806 EXPECT_TRUE(called); 806 EXPECT_TRUE(called);
807 807
808 ASSERT_EQ(1, loader->num_loads()); 808 ASSERT_EQ(1, loader->num_loads());
809 EXPECT_EQ(requestor_url, loader->last_requestor_url()); 809 EXPECT_EQ(requestor_url, loader->last_requestor_url());
810 } 810 }
811 811
812 } // namespace 812 } // namespace
813 } // namespace shell 813 } // namespace shell
814 } // namespace mojo 814 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/application_manager.cc ('k') | mojo/shell/content_handler_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698