OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/rlz/rlz.h" | 5 #include "chrome/browser/rlz/rlz.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
11 #include "chrome/browser/autocomplete/autocomplete_input.h" | |
12 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/google/google_brand.h" | 12 #include "chrome/browser/google/google_brand.h" |
14 #include "chrome/browser/omnibox/omnibox_log.h" | 13 #include "chrome/browser/omnibox/omnibox_log.h" |
15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/installer/util/browser_distribution.h" | 15 #include "chrome/installer/util/browser_distribution.h" |
17 #include "chrome/installer/util/google_update_constants.h" | 16 #include "chrome/installer/util/google_update_constants.h" |
| 17 #include "components/metrics/proto/omnibox_event.pb.h" |
18 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
19 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
22 #include "rlz/test/rlz_test_helpers.h" | 22 #include "rlz/test/rlz_test_helpers.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
27 #endif | 27 #endif |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 #endif | 233 #endif |
234 | 234 |
235 void RlzLibTest::SimulateOmniboxUsage() { | 235 void RlzLibTest::SimulateOmniboxUsage() { |
236 // Create a dummy OmniboxLog object. The 'is_popup_open' field needs to be | 236 // Create a dummy OmniboxLog object. The 'is_popup_open' field needs to be |
237 // true to trigger record of the first search. All other fields are passed in | 237 // true to trigger record of the first search. All other fields are passed in |
238 // with empty or invalid values. | 238 // with empty or invalid values. |
239 AutocompleteResult empty_result; | 239 AutocompleteResult empty_result; |
240 OmniboxLog dummy(base::string16(), false, metrics::OmniboxInputType::INVALID, | 240 OmniboxLog dummy(base::string16(), false, metrics::OmniboxInputType::INVALID, |
241 true, 0, false, -1, | 241 true, 0, false, -1, |
242 AutocompleteInput::INVALID_SPEC, | 242 metrics::OmniboxEventProto::INVALID_SPEC, |
243 base::TimeDelta::FromSeconds(0), 0, | 243 base::TimeDelta::FromSeconds(0), 0, |
244 base::TimeDelta::FromSeconds(0), | 244 base::TimeDelta::FromSeconds(0), |
245 AutocompleteResult()); | 245 AutocompleteResult()); |
246 | 246 |
247 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 247 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
248 content::NotificationService::AllSources(), | 248 content::NotificationService::AllSources(), |
249 content::Details<OmniboxLog>(&dummy)); | 249 content::Details<OmniboxLog>(&dummy)); |
250 } | 250 } |
251 | 251 |
252 void RlzLibTest::SimulateHomepageUsage() { | 252 void RlzLibTest::SimulateHomepageUsage() { |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(), | 887 RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(), |
888 rlz_lib::FIRST_SEARCH); | 888 rlz_lib::FIRST_SEARCH); |
889 | 889 |
890 ExpectEventRecorded(kOmniboxFirstSearch, true); | 890 ExpectEventRecorded(kOmniboxFirstSearch, true); |
891 | 891 |
892 RLZTracker::ClearRlzState(); | 892 RLZTracker::ClearRlzState(); |
893 | 893 |
894 ExpectEventRecorded(kOmniboxFirstSearch, false); | 894 ExpectEventRecorded(kOmniboxFirstSearch, false); |
895 } | 895 } |
896 #endif // defined(OS_CHROMEOS) | 896 #endif // defined(OS_CHROMEOS) |
OLD | NEW |