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

Unified Diff: shell/shell_apptest.cc

Issue 1367863004: Fix ShellHTTPAppTest#QueryHandling test. (Closed) Base URL: https://github.com/domokit/mojo.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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/shell_apptest.cc
diff --git a/shell/shell_apptest.cc b/shell/shell_apptest.cc
index 2a5a5dfa9503e6e6923b3c7c8f922c5f20afa1e8..931cc4d61548c110598056110a4508b9eb9efdf3 100644
--- a/shell/shell_apptest.cc
+++ b/shell/shell_apptest.cc
@@ -157,23 +157,26 @@ TEST_F(ShellHTTPAppTest, MAYBE_QueryHandling) {
application_impl()->ConnectToService(GetURL("app?bar"), &pingable2);
int num_responses = 0;
- auto callback = [this, &num_responses](const String& app_url,
- const String& connection_url,
- const String& message) {
- EXPECT_EQ(GetURL("app"), app_url);
- EXPECT_EQ("hello", message);
- ++num_responses;
- if (num_responses == 1) {
- EXPECT_EQ(GetURL("app?foo"), connection_url);
- } else if (num_responses == 2) {
- EXPECT_EQ(GetURL("app?bar"), connection_url);
- base::MessageLoop::current()->Quit();
- } else {
- CHECK(false);
- }
+ auto callbacks_builder = [this, &num_responses](int query_index) {
+ return [this, &num_responses, query_index](const String& app_url,
+ const String& connection_url,
+ const String& message) {
+ EXPECT_EQ(GetURL("app"), app_url);
+ EXPECT_EQ("hello", message);
+ if (query_index == 1) {
+ EXPECT_EQ(GetURL("app?foo"), connection_url);
+ } else if (query_index == 2) {
+ EXPECT_EQ(GetURL("app?bar"), connection_url);
+ } else {
+ CHECK(false);
+ }
+ ++num_responses;
+ if (num_responses == 2)
+ base::MessageLoop::current()->Quit();
+ };
};
- pingable1->Ping("hello", callback);
- pingable2->Ping("hello", callback);
+ pingable1->Ping("hello", callbacks_builder(1));
+ pingable2->Ping("hello", callbacks_builder(2));
base::RunLoop().Run();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698