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

Unified Diff: chrome/browser/metrics/variations/ui_string_overrider_unittest.cc

Issue 1363243004: Allow embedders to share code to override UI strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to test and class and fix typo 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
Index: chrome/browser/metrics/variations/ui_string_overrider_unittest.cc
diff --git a/chrome/browser/metrics/variations/generated_resources_map_lookup_unittest.cc b/chrome/browser/metrics/variations/ui_string_overrider_unittest.cc
similarity index 51%
rename from chrome/browser/metrics/variations/generated_resources_map_lookup_unittest.cc
rename to chrome/browser/metrics/variations/ui_string_overrider_unittest.cc
index a97f1f6cf5db2d3247e0fbe26af7825516ec7c38..5aace0e142f84d6cfabb73d88fb62399c9255e08 100644
--- a/chrome/browser/metrics/variations/generated_resources_map_lookup_unittest.cc
+++ b/chrome/browser/metrics/variations/ui_string_overrider_unittest.cc
@@ -2,13 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/metrics/variations/generated_resources_map.h"
+#include "components/variations/service/ui_string_overrider.h"
+#include "chrome/browser/metrics/variations/generated_resources_map.h"
#include "testing/gtest/include/gtest/gtest.h"
+// TODO(sdefresne): componentize this tests as part of the resolution
+// of http://crbug.com/534257 ("Decouple iOS port from using //chrome's
+// VariationsService client").
+
namespace chrome_variations {
-TEST(GeneratedResourcesMapLookupTest, LookupNotFound) {
+class UIStringOverriderTest : public ::testing::Test {
+ public:
+ UIStringOverriderTest()
+ : provider_(kResourceHashes, kResourceIndices, kNumResources) {}
+
+ int GetResourceIndex(uint32_t hash) {
+ return provider_.GetResourceIndex(hash);
+ }
+
+ private:
+ variations::UIStringOverrider provider_;
+
+ DISALLOW_COPY_AND_ASSIGN(UIStringOverriderTest);
+};
+
+TEST_F(UIStringOverriderTest, LookupNotFound) {
EXPECT_EQ(-1, GetResourceIndex(0));
EXPECT_EQ(-1, GetResourceIndex(kResourceHashes[kNumResources - 1] + 1));
@@ -17,7 +37,7 @@ TEST(GeneratedResourcesMapLookupTest, LookupNotFound) {
EXPECT_EQ(-1, GetResourceIndex(13257681U));
}
-TEST(GeneratedResourcesMapLookupTest, LookupFound) {
+TEST_F(UIStringOverriderTest, LookupFound) {
for (size_t i = 0; i < kNumResources; ++i)
EXPECT_EQ(kResourceIndices[i], GetResourceIndex(kResourceHashes[i]));
}
« no previous file with comments | « chrome/browser/metrics/variations/generated_resources_map_lookup_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698