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" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { |
253 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 253 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
254 entry->SetPageID(0); | 254 entry->SetPageID(0); |
255 entry->SetTransitionType(content::PAGE_TRANSITION_HOME_PAGE); | 255 entry->SetTransitionType(ui::PAGE_TRANSITION_HOME_PAGE); |
256 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 256 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
257 content::NotificationService::AllSources(), | 257 content::NotificationService::AllSources(), |
258 content::Details<NavigationEntry>(entry.get())); | 258 content::Details<NavigationEntry>(entry.get())); |
259 } | 259 } |
260 | 260 |
261 void RlzLibTest::SimulateAppListUsage() { | 261 void RlzLibTest::SimulateAppListUsage() { |
262 RLZTracker::RecordAppListSearch(); | 262 RLZTracker::RecordAppListSearch(); |
263 } | 263 } |
264 | 264 |
265 void RlzLibTest::InvokeDelayedInit() { | 265 void RlzLibTest::InvokeDelayedInit() { |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 EXPECT_TRUE(RLZTracker::GetAccessPointRlz( | 820 EXPECT_TRUE(RLZTracker::GetAccessPointRlz( |
821 RLZTracker::ChromeHomePage(), &rlz)); | 821 RLZTracker::ChromeHomePage(), &rlz)); |
822 EXPECT_STREQ(kNewHomepageRlzString, base::UTF16ToUTF8(rlz).c_str()); | 822 EXPECT_STREQ(kNewHomepageRlzString, base::UTF16ToUTF8(rlz).c_str()); |
823 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz)); | 823 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz)); |
824 EXPECT_STREQ(kNewAppListRlzString, base::UTF16ToUTF8(rlz).c_str()); | 824 EXPECT_STREQ(kNewAppListRlzString, base::UTF16ToUTF8(rlz).c_str()); |
825 } | 825 } |
826 | 826 |
827 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { | 827 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { |
828 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 828 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
829 entry->SetPageID(0); | 829 entry->SetPageID(0); |
830 entry->SetTransitionType(content::PAGE_TRANSITION_LINK); | 830 entry->SetTransitionType(ui::PAGE_TRANSITION_LINK); |
831 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 831 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
832 content::NotificationService::AllSources(), | 832 content::NotificationService::AllSources(), |
833 content::Details<NavigationEntry>(NULL)); | 833 content::Details<NavigationEntry>(NULL)); |
834 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 834 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
835 content::NotificationService::AllSources(), | 835 content::NotificationService::AllSources(), |
836 content::Details<NavigationEntry>(entry.get())); | 836 content::Details<NavigationEntry>(entry.get())); |
837 } | 837 } |
838 | 838 |
839 // TODO(thakis): Reactivation doesn't exist on Mac yet. | 839 // TODO(thakis): Reactivation doesn't exist on Mac yet. |
840 #if defined(OS_WIN) | 840 #if defined(OS_WIN) |
(...skipping 46 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 |