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

Unified Diff: mojo/shell/application_manager_unittest.cc

Issue 1307273004: Group ConnectToApplication-related info into a params struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/application_manager.cc ('k') | mojo/shell/capability_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/application_manager_unittest.cc
diff --git a/mojo/shell/application_manager_unittest.cc b/mojo/shell/application_manager_unittest.cc
index 90f9edbf5006987837a674be621d19077741571a..56d2fb5bbff54da65d2e2d214966c76324cdc89e 100644
--- a/mojo/shell/application_manager_unittest.cc
+++ b/mojo/shell/application_manager_unittest.cc
@@ -806,13 +806,12 @@ TEST_F(ApplicationManagerTest, TestEndApplicationClosure) {
scoped_ptr<ApplicationLoader>(loader), "test");
bool called = false;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test:test");
- application_manager_->ConnectToApplication(
- nullptr, request.Pass(), std::string(), GURL(), nullptr, nullptr,
- GetPermissiveCapabilityFilter(),
- base::Bind(&QuitClosure, base::Unretained(&called)),
- EmptyConnectCallback());
+ scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams);
+ params->SetURLInfo(GURL("test:test"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_on_application_end(
+ base::Bind(&QuitClosure, base::Unretained(&called)));
+ application_manager_->ConnectToApplication(params.Pass());
loop_.Run();
EXPECT_TRUE(called);
}
@@ -835,13 +834,14 @@ TEST(ApplicationManagerTest2, ContentHandlerConnectionGetsRequestorURL) {
content_handler_url);
bool called = false;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test:test");
- application_manager.ConnectToApplication(
- nullptr, request.Pass(), std::string(), requestor_url, nullptr, nullptr,
- GetPermissiveCapabilityFilter(),
- base::Bind(&QuitClosure, base::Unretained(&called)),
- EmptyConnectCallback());
+ scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams);
+ params->set_originator_identity(Identity(requestor_url));
+ params->set_originator_filter(GetPermissiveCapabilityFilter());
+ params->SetURLInfo(GURL("test:test"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_on_application_end(
+ base::Bind(&QuitClosure, base::Unretained(&called)));
+ application_manager.ConnectToApplication(params.Pass());
loop.Run();
EXPECT_TRUE(called);
@@ -904,15 +904,17 @@ TEST(ApplicationManagerTest2,
uint32_t content_handler_id;
{
base::RunLoop run_loop;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test:test");
- application_manager.ConnectToApplication(
- nullptr, request.Pass(), std::string(), requestor_url, nullptr, nullptr,
- GetPermissiveCapabilityFilter(), base::Closure(),
- [&content_handler_id, &run_loop](uint32_t t) {
- content_handler_id = t;
- run_loop.Quit();
- });
+ scoped_ptr<ConnectToApplicationParams> params(
+ new ConnectToApplicationParams);
+ params->set_originator_identity(Identity(requestor_url));
+ params->set_originator_filter(GetPermissiveCapabilityFilter());
+ params->SetURLInfo(GURL("test:test"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_connect_callback([&content_handler_id, &run_loop](uint32_t t) {
+ content_handler_id = t;
+ run_loop.Quit();
+ });
+ application_manager.ConnectToApplication(params.Pass());
run_loop.Run();
EXPECT_NE(Shell::kInvalidContentHandlerID, content_handler_id);
}
@@ -920,15 +922,17 @@ TEST(ApplicationManagerTest2,
uint32_t content_handler_id2;
{
base::RunLoop run_loop;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test:test");
- application_manager.ConnectToApplication(
- nullptr, request.Pass(), std::string(), requestor_url, nullptr, nullptr,
- GetPermissiveCapabilityFilter(), base::Closure(),
- [&content_handler_id2, &run_loop](uint32_t t) {
- content_handler_id2 = t;
- run_loop.Quit();
- });
+ scoped_ptr<ConnectToApplicationParams> params(
+ new ConnectToApplicationParams);
+ params->set_originator_identity(Identity(requestor_url));
+ params->set_originator_filter(GetPermissiveCapabilityFilter());
+ params->SetURLInfo(GURL("test:test"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_connect_callback([&content_handler_id2, &run_loop](uint32_t t) {
+ content_handler_id2 = t;
+ run_loop.Quit();
+ });
+ application_manager.ConnectToApplication(params.Pass());
run_loop.Run();
EXPECT_NE(Shell::kInvalidContentHandlerID, content_handler_id2);
}
@@ -958,15 +962,17 @@ TEST(ApplicationManagerTest2, DifferedContentHandlersGetDifferentIDs) {
uint32_t content_handler_id;
{
base::RunLoop run_loop;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test:test");
- application_manager.ConnectToApplication(
- nullptr, request.Pass(), std::string(), requestor_url, nullptr, nullptr,
- GetPermissiveCapabilityFilter(), base::Closure(),
- [&content_handler_id, &run_loop](uint32_t t) {
- content_handler_id = t;
- run_loop.Quit();
- });
+ scoped_ptr<ConnectToApplicationParams> params(
+ new ConnectToApplicationParams);
+ params->set_originator_identity(Identity(requestor_url));
+ params->set_originator_filter(GetPermissiveCapabilityFilter());
+ params->SetURLInfo(GURL("test:test"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_connect_callback([&content_handler_id, &run_loop](uint32_t t) {
+ content_handler_id = t;
+ run_loop.Quit();
+ });
+ application_manager.ConnectToApplication(params.Pass());
run_loop.Run();
EXPECT_NE(Shell::kInvalidContentHandlerID, content_handler_id);
}
@@ -987,15 +993,17 @@ TEST(ApplicationManagerTest2, DifferedContentHandlersGetDifferentIDs) {
uint32_t content_handler_id2;
{
base::RunLoop run_loop;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test2:test2");
- application_manager.ConnectToApplication(
- nullptr, request.Pass(), std::string(), requestor_url, nullptr, nullptr,
- GetPermissiveCapabilityFilter(), base::Closure(),
- [&content_handler_id2, &run_loop](uint32_t t) {
- content_handler_id2 = t;
- run_loop.Quit();
- });
+ scoped_ptr<ConnectToApplicationParams> params(
+ new ConnectToApplicationParams);
+ params->set_originator_identity(Identity(requestor_url));
+ params->set_originator_filter(GetPermissiveCapabilityFilter());
+ params->SetURLInfo(GURL("test2:test2"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_connect_callback([&content_handler_id2, &run_loop](uint32_t t) {
+ content_handler_id2 = t;
+ run_loop.Quit();
+ });
+ application_manager.ConnectToApplication(params.Pass());
run_loop.Run();
EXPECT_NE(Shell::kInvalidContentHandlerID, content_handler_id2);
}
@@ -1008,12 +1016,12 @@ TEST_F(ApplicationManagerTest,
scoped_ptr<ApplicationLoader>(new TestApplicationLoader), "test");
uint32_t content_handler_id = 1u;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("test:test");
- application_manager_->ConnectToApplication(
- nullptr, request.Pass(), std::string(), GURL(), nullptr, nullptr,
- GetPermissiveCapabilityFilter(), base::Closure(),
+ scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams);
+ params->SetURLInfo(GURL("test:test"));
+ params->set_filter(GetPermissiveCapabilityFilter());
+ params->set_connect_callback(
[&content_handler_id](uint32_t t) { content_handler_id = t; });
+ application_manager_->ConnectToApplication(params.Pass());
EXPECT_EQ(0u, content_handler_id);
}
« no previous file with comments | « mojo/shell/application_manager.cc ('k') | mojo/shell/capability_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698