| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4378 | 4378 |
| 4379 EXPECT_TRUE(AutofillMetrics::LogUkm( | 4379 EXPECT_TRUE(AutofillMetrics::LogUkm( |
| 4380 ukm_service_test_harness.test_ukm_service(), url, | 4380 ukm_service_test_harness.test_ukm_service(), url, |
| 4381 internal::kUKMCardUploadDecisionEntryName, metrics)); | 4381 internal::kUKMCardUploadDecisionEntryName, metrics)); |
| 4382 | 4382 |
| 4383 // Make sure that the UKM was logged correctly. | 4383 // Make sure that the UKM was logged correctly. |
| 4384 ukm::TestUkmService* ukm_service = | 4384 ukm::TestUkmService* ukm_service = |
| 4385 ukm_service_test_harness.test_ukm_service(); | 4385 ukm_service_test_harness.test_ukm_service(); |
| 4386 | 4386 |
| 4387 ASSERT_EQ(1U, ukm_service->sources_count()); | 4387 ASSERT_EQ(1U, ukm_service->sources_count()); |
| 4388 const ukm::UkmSource* source = ukm_service->GetSource(0); | 4388 const ukm::UkmSource* source = |
| 4389 ukm_service->GetSourceForUrl(url.spec().c_str()); |
| 4389 EXPECT_EQ(url.spec(), source->url().spec()); | 4390 EXPECT_EQ(url.spec(), source->url().spec()); |
| 4390 | 4391 |
| 4391 EXPECT_EQ(1U, ukm_service->entries_count()); | 4392 EXPECT_EQ(1U, ukm_service->entries_count()); |
| 4392 const ukm::UkmEntry* entry = ukm_service->GetEntry(0); | 4393 const ukm::UkmEntry* entry = ukm_service->GetEntry(0); |
| 4393 EXPECT_EQ(source->id(), entry->source_id()); | 4394 EXPECT_EQ(source->id(), entry->source_id()); |
| 4394 | 4395 |
| 4395 // Make sure that an card upload decision entry was logged. | 4396 // Make sure that an card upload decision entry was logged. |
| 4396 ukm::Entry entry_proto; | 4397 ukm::Entry entry_proto; |
| 4397 entry->PopulateProto(&entry_proto); | 4398 entry->PopulateProto(&entry_proto); |
| 4398 EXPECT_EQ(source->id(), entry_proto.source_id()); | 4399 EXPECT_EQ(source->id(), entry_proto.source_id()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4450 GURL url("https://www.google.com"); | 4451 GURL url("https://www.google.com"); |
| 4451 std::map<std::string, int> metrics; | 4452 std::map<std::string, int> metrics; |
| 4452 metrics.insert(std::make_pair("metric", 1)); | 4453 metrics.insert(std::make_pair("metric", 1)); |
| 4453 | 4454 |
| 4454 EXPECT_FALSE(AutofillMetrics::LogUkm( | 4455 EXPECT_FALSE(AutofillMetrics::LogUkm( |
| 4455 ukm_service_test_harness.test_ukm_service(), url, "test_ukm", metrics)); | 4456 ukm_service_test_harness.test_ukm_service(), url, "test_ukm", metrics)); |
| 4456 EXPECT_EQ(0U, ukm_service_test_harness.test_ukm_service()->sources_count()); | 4457 EXPECT_EQ(0U, ukm_service_test_harness.test_ukm_service()->sources_count()); |
| 4457 } | 4458 } |
| 4458 | 4459 |
| 4459 } // namespace autofill | 4460 } // namespace autofill |
| OLD | NEW |