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

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

Issue 1471753002: Do not consider url query when setting application arguments. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 1 month 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 | « shell/application_manager/application_manager.cc ('k') | no next file » | 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/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 am.ConnectToService(test_url, &test_service); 520 am.ConnectToService(test_url, &test_service);
521 TestClient test_client(test_service.Pass()); 521 TestClient test_client(test_service.Pass());
522 test_client.Test("test"); 522 test_client.Test("test");
523 loop_.Run(); 523 loop_.Run();
524 std::vector<std::string> app_args = loader->GetArgs(); 524 std::vector<std::string> app_args = loader->GetArgs();
525 ASSERT_EQ(args.size(), app_args.size()); 525 ASSERT_EQ(args.size(), app_args.size());
526 EXPECT_EQ(args[0], app_args[0]); 526 EXPECT_EQ(args[0], app_args[0]);
527 EXPECT_EQ(args[1], app_args[1]); 527 EXPECT_EQ(args[1], app_args[1]);
528 } 528 }
529 529
530 // Confirm that arguments are sent to an application in the presence of query
531 // parameters.
532 TEST_F(ApplicationManagerTest, ArgsWithQuery) {
533 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
534 GURL test_url("test:test");
535 GURL test_url_with_query("test:test?foo=bar");
536 std::vector<std::string> args;
537 args.push_back("test_arg1");
538 am.SetArgsForURL(args, test_url);
539 TestApplicationLoader* loader = new TestApplicationLoader;
540 loader->set_context(&context_);
541 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
542 TestServicePtr test_service;
543 am.ConnectToService(test_url_with_query, &test_service);
544 TestClient test_client(test_service.Pass());
545 test_client.Test("test");
546 loop_.Run();
547 std::vector<std::string> app_args = loader->GetArgs();
548 ASSERT_EQ(args.size(), app_args.size());
549 EXPECT_EQ(args[0], app_args[0]);
550 }
551
530 // Confirm that arguments are aggregated through mappings. 552 // Confirm that arguments are aggregated through mappings.
531 TEST_F(ApplicationManagerTest, ArgsAndMapping) { 553 TEST_F(ApplicationManagerTest, ArgsAndMapping) {
532 ApplicationManager am(ApplicationManager::Options(), &test_delegate_); 554 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
533 GURL test_url("test:test"); 555 GURL test_url("test:test");
534 GURL test_url2("test:test2"); 556 GURL test_url2("test:test2");
535 test_delegate_.AddMapping(test_url, test_url2); 557 test_delegate_.AddMapping(test_url, test_url2);
536 std::vector<std::string> args; 558 std::vector<std::string> args;
537 args.push_back("test_arg1"); 559 args.push_back("test_arg1");
538 args.push_back("test_arg2"); 560 args.push_back("test_arg2");
539 am.SetArgsForURL(args, test_url); 561 am.SetArgsForURL(args, test_url);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 bool called = false; 815 bool called = false;
794 application_manager_->ConnectToApplication( 816 application_manager_->ConnectToApplication(
795 GURL("test:test"), GURL(), nullptr, nullptr, 817 GURL("test:test"), GURL(), nullptr, nullptr,
796 base::Bind(&QuitClosure, base::Unretained(&called))); 818 base::Bind(&QuitClosure, base::Unretained(&called)));
797 loop_.Run(); 819 loop_.Run();
798 EXPECT_TRUE(called); 820 EXPECT_TRUE(called);
799 } 821 }
800 822
801 } // namespace 823 } // namespace
802 } // namespace shell 824 } // namespace shell
OLDNEW
« no previous file with comments | « shell/application_manager/application_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698