| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 EXPECT_PRED_FORMAT2(CmpHelperSTRNC, str, substr) | 73 EXPECT_PRED_FORMAT2(CmpHelperSTRNC, str, substr) |
| 74 | 74 |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 // Test class for RLZ tracker. Makes some member functions public and | 77 // Test class for RLZ tracker. Makes some member functions public and |
| 78 // overrides others to make it easier to test. | 78 // overrides others to make it easier to test. |
| 79 class TestRLZTracker : public RLZTracker { | 79 class TestRLZTracker : public RLZTracker { |
| 80 public: | 80 public: |
| 81 using RLZTracker::DelayedInit; | 81 using RLZTracker::DelayedInit; |
| 82 using RLZTracker::Observe; | 82 using RLZTracker::Observe; |
| 83 using RLZTracker::RLZ_PAGETRANSITION_HOME_PAGE; | |
| 84 | 83 |
| 85 TestRLZTracker() : pingnow_called_(false), assume_io_thread_(false) { | 84 TestRLZTracker() : pingnow_called_(false), assume_io_thread_(false) { |
| 86 set_tracker(this); | 85 set_tracker(this); |
| 87 } | 86 } |
| 88 | 87 |
| 89 virtual ~TestRLZTracker() { | 88 virtual ~TestRLZTracker() { |
| 90 set_tracker(NULL); | 89 set_tracker(NULL); |
| 91 } | 90 } |
| 92 | 91 |
| 93 bool pingnow_called() const { | 92 bool pingnow_called() const { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 196 } |
| 198 | 197 |
| 199 void RlzLibTest::SimulateOmniboxUsage() { | 198 void RlzLibTest::SimulateOmniboxUsage() { |
| 200 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 199 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 201 NotificationService::AllSources(), | 200 NotificationService::AllSources(), |
| 202 Details<AutocompleteLog>(NULL)); | 201 Details<AutocompleteLog>(NULL)); |
| 203 } | 202 } |
| 204 | 203 |
| 205 void RlzLibTest::SimulateHomepageUsage() { | 204 void RlzLibTest::SimulateHomepageUsage() { |
| 206 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), | 205 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), |
| 207 TestRLZTracker::RLZ_PAGETRANSITION_HOME_PAGE); | 206 PageTransition::HOME_PAGE); |
| 208 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 207 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 209 NotificationService::AllSources(), | 208 NotificationService::AllSources(), |
| 210 Details<NavigationEntry>(&entry)); | 209 Details<NavigationEntry>(&entry)); |
| 211 } | 210 } |
| 212 | 211 |
| 213 void RlzLibTest::InvokeDelayedInit() { | 212 void RlzLibTest::InvokeDelayedInit() { |
| 214 tracker_.DelayedInit(); | 213 tracker_.DelayedInit(); |
| 215 } | 214 } |
| 216 | 215 |
| 217 void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) { | 216 void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { | 526 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { |
| 528 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), | 527 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), |
| 529 PageTransition::LINK); | 528 PageTransition::LINK); |
| 530 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 529 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 531 NotificationService::AllSources(), | 530 NotificationService::AllSources(), |
| 532 Details<NavigationEntry>(NULL)); | 531 Details<NavigationEntry>(NULL)); |
| 533 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, | 532 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 534 NotificationService::AllSources(), | 533 NotificationService::AllSources(), |
| 535 Details<NavigationEntry>(&entry)); | 534 Details<NavigationEntry>(&entry)); |
| 536 } | 535 } |
| OLD | NEW |