OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <cstddef> | 5 #include <cstddef> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 | 60 |
61 payments::mojom::PaymentAppManifestPtr manifest = | 61 payments::mojom::PaymentAppManifestPtr manifest = |
62 payments::mojom::PaymentAppManifest::New(); | 62 payments::mojom::PaymentAppManifest::New(); |
63 manifest->icon = std::string("payment-app-icon"); | 63 manifest->icon = std::string("payment-app-icon"); |
64 manifest->name = scope_url.spec(); | 64 manifest->name = scope_url.spec(); |
65 manifest->options.push_back(std::move(option)); | 65 manifest->options.push_back(std::move(option)); |
66 | 66 |
67 payments::mojom::PaymentAppManifestError error = payments::mojom:: | 67 payments::mojom::PaymentAppManifestError error = payments::mojom:: |
68 PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED; | 68 PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED; |
69 bool called = false; | 69 bool called = false; |
70 SetManifest(manager, scope_url.spec(), std::move(manifest), | 70 SetManifest(manager, std::move(manifest), |
71 base::Bind(&SetManifestCallback, &called, &error)); | 71 base::Bind(&SetManifestCallback, &called, &error)); |
72 ASSERT_TRUE(called); | 72 ASSERT_TRUE(called); |
73 | 73 |
74 ASSERT_EQ(error, payments::mojom::PaymentAppManifestError::NONE); | 74 ASSERT_EQ(error, payments::mojom::PaymentAppManifestError::NONE); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextTest); | 78 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextTest); |
79 }; | 79 }; |
80 | 80 |
(...skipping 12 matching lines...) Expand all Loading... | |
93 } | 93 } |
94 | 94 |
95 PaymentAppContext::Manifests manifests; | 95 PaymentAppContext::Manifests manifests; |
96 bool called = false; | 96 bool called = false; |
97 GetAllManifests(base::Bind(&GetAllManifestsCallback, &called, &manifests)); | 97 GetAllManifests(base::Bind(&GetAllManifestsCallback, &called, &manifests)); |
98 ASSERT_TRUE(called); | 98 ASSERT_TRUE(called); |
99 | 99 |
100 ASSERT_EQ(manifests.size(), 3U); | 100 ASSERT_EQ(manifests.size(), 3U); |
101 size_t i = 0; | 101 size_t i = 0; |
102 for (const auto& manifest : manifests) { | 102 for (const auto& manifest : manifests) { |
103 EXPECT_EQ(manifest.second->icon.value(), "payment-app-icon"); | 103 EXPECT_EQ(manifest.second->icon.value(), "payment-app-icon"); |
please use gerrit instead
2016/12/20 17:25:17
You seem to have reversed the "expected" and "actu
zino
2016/12/20 17:30:53
Sure,
So, I made a CL for this. You are already a
| |
104 EXPECT_EQ(manifest.second->name, kPaymentAppInfo[i++].scopeUrl); | 104 EXPECT_EQ(manifest.second->name, kPaymentAppInfo[i++].scopeUrl); |
105 ASSERT_EQ(manifest.second->options.size(), 1U); | 105 ASSERT_EQ(manifest.second->options.size(), 1U); |
106 EXPECT_EQ(manifest.second->options[0]->icon.value(), "payment-app-icon"); | 106 EXPECT_EQ(manifest.second->options[0]->icon.value(), "payment-app-icon"); |
107 EXPECT_EQ(manifest.second->options[0]->name, "Visa ****"); | 107 EXPECT_EQ(manifest.second->options[0]->name, "Visa ****"); |
108 EXPECT_EQ(manifest.second->options[0]->id, "payment-app-id"); | 108 EXPECT_EQ(manifest.second->options[0]->id, "payment-app-id"); |
109 ASSERT_EQ(manifest.second->options[0]->enabled_methods.size(), 1U); | 109 ASSERT_EQ(manifest.second->options[0]->enabled_methods.size(), 1U); |
110 EXPECT_EQ(manifest.second->options[0]->enabled_methods[0], "visa"); | 110 EXPECT_EQ(manifest.second->options[0]->enabled_methods[0], "visa"); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 } // namespace content | 114 } // namespace content |
OLD | NEW |