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

Unified Diff: components/resource_provider/resource_provider_unittest.cc

Issue 1816323002: Converts resource_provider apptests to unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add quit to delegate and remove dep Created 4 years, 9 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 | « components/resource_provider/resource_provider_test_app.cc ('k') | components/resource_provider/test.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/resource_provider/resource_provider_unittest.cc
diff --git a/components/resource_provider/resource_provider_unittest.cc b/components/resource_provider/resource_provider_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a24bf977b71931d7659537224957afae4a138bb5
--- /dev/null
+++ b/components/resource_provider/resource_provider_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/macros.h"
+#include "components/resource_provider/test.mojom.h"
+#include "mojo/public/cpp/bindings/string.h"
+#include "mojo/shell/public/cpp/shell_test.h"
+
+namespace resource_provider {
+namespace test {
+
+class ResourceProviderTest : public mojo::test::ShellTest {
+ public:
+ ResourceProviderTest()
+ : mojo::test::ShellTest("exe:resource_provider_unittests") {}
+ ~ResourceProviderTest() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ResourceProviderTest);
+};
+
+TEST_F(ResourceProviderTest, FetchOneResource) {
+ mojom::TestPtr test_app;
+ mojo::String resource1;
+ connector()->ConnectToInterface("mojo:resource_provider_test_app", &test_app);
+ ASSERT_TRUE(test_app->GetResource1(&resource1));
+ EXPECT_EQ("test data\n", resource1);
+}
+
+TEST_F(ResourceProviderTest, FetchTwoResources) {
+ mojom::TestPtr test_app;
+ mojo::String resource1, resource2;
+ connector()->ConnectToInterface("mojo:resource_provider_test_app", &test_app);
+ ASSERT_TRUE(test_app->GetBothResources(&resource1, &resource2));
+ EXPECT_EQ("test data\n", resource1);
+ EXPECT_EQ("xxyy\n", resource2);
+}
+
+} // namespace test
+} // namespace resource_provider
« no previous file with comments | « components/resource_provider/resource_provider_test_app.cc ('k') | components/resource_provider/test.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698