OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/test/test_reg_util_win.h" | 10 #include "base/test/test_reg_util_win.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 void RlzLibTest::SimulateOmniboxUsage() { | 233 void RlzLibTest::SimulateOmniboxUsage() { |
234 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 234 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
235 content::NotificationService::AllSources(), | 235 content::NotificationService::AllSources(), |
236 content::Details<AutocompleteLog>(NULL)); | 236 content::Details<AutocompleteLog>(NULL)); |
237 } | 237 } |
238 | 238 |
239 void RlzLibTest::SimulateHomepageUsage() { | 239 void RlzLibTest::SimulateHomepageUsage() { |
240 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), | 240 NavigationEntry entry(NULL, 0, GURL(), content::Referrer(), string16(), |
241 content::PAGE_TRANSITION_HOME_PAGE, false); | 241 content::PAGE_TRANSITION_HOME_PAGE, false); |
242 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 242 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
243 content::NotificationService::AllSources(), | 243 content::NotificationService::AllSources(), |
244 content::Details<NavigationEntry>(&entry)); | 244 content::Details<NavigationEntry>(&entry)); |
245 } | 245 } |
246 | 246 |
247 void RlzLibTest::InvokeDelayedInit() { | 247 void RlzLibTest::InvokeDelayedInit() { |
248 tracker_.DelayedInit(); | 248 tracker_.DelayedInit(); |
249 } | 249 } |
250 | 250 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // Make sure cache is now updated. | 573 // Make sure cache is now updated. |
574 tracker_.set_assume_not_ui_thread(false); | 574 tracker_.set_assume_not_ui_thread(false); |
575 | 575 |
576 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz)); | 576 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz)); |
577 EXPECT_STREQ(kNewOmniboxRlzString, WideToUTF8(rlz).c_str()); | 577 EXPECT_STREQ(kNewOmniboxRlzString, WideToUTF8(rlz).c_str()); |
578 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, &rlz)); | 578 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, &rlz)); |
579 EXPECT_STREQ(kNewHomepageRlzString, WideToUTF8(rlz).c_str()); | 579 EXPECT_STREQ(kNewHomepageRlzString, WideToUTF8(rlz).c_str()); |
580 } | 580 } |
581 | 581 |
582 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { | 582 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { |
583 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), | 583 NavigationEntry entry(NULL, 0, GURL(), content::Referrer(), string16(), |
584 content::PAGE_TRANSITION_LINK, false); | 584 content::PAGE_TRANSITION_LINK, false); |
585 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 585 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
586 content::NotificationService::AllSources(), | 586 content::NotificationService::AllSources(), |
587 content::Details<NavigationEntry>(NULL)); | 587 content::Details<NavigationEntry>(NULL)); |
588 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 588 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
589 content::NotificationService::AllSources(), | 589 content::NotificationService::AllSources(), |
590 content::Details<NavigationEntry>(&entry)); | 590 content::Details<NavigationEntry>(&entry)); |
591 } | 591 } |
592 | 592 |
593 TEST_F(RlzLibTest, ReactivationNonOrganicNonOrganic) { | 593 TEST_F(RlzLibTest, ReactivationNonOrganicNonOrganic) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 SetMainBrand("GGLS"); | 626 SetMainBrand("GGLS"); |
627 SetReactivationBrand("GGRS"); | 627 SetReactivationBrand("GGRS"); |
628 | 628 |
629 RLZTracker::InitRlzDelayed(true, 20, true, true); | 629 RLZTracker::InitRlzDelayed(true, 20, true, true); |
630 InvokeDelayedInit(); | 630 InvokeDelayedInit(); |
631 | 631 |
632 ExpectRlzPingSent(false); | 632 ExpectRlzPingSent(false); |
633 ExpectReactivationRlzPingSent(false); | 633 ExpectReactivationRlzPingSent(false); |
634 } | 634 } |
635 | 635 |
OLD | NEW |