| 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/files/scoped_temp_dir.h" |
| 7 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" |
| 8 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 9 #include "base/path_service.h" | |
| 10 #include "base/scoped_temp_dir.h" | |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_log.h" | 12 #include "chrome/browser/autocomplete/autocomplete_log.h" |
| 13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/env_vars.h" | 16 #include "chrome/common/env_vars.h" |
| 17 #include "chrome/installer/util/browser_distribution.h" | 17 #include "chrome/installer/util/browser_distribution.h" |
| 18 #include "chrome/installer/util/google_update_constants.h" | 18 #include "chrome/installer/util/google_update_constants.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/notification_details.h" |
| 20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/browser/notification_details.h" | |
| 22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.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/test/test_reg_util_win.h" | 26 #include "base/test/test_reg_util_win.h" |
| 27 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
| 28 #include "rlz/win/lib/rlz_lib.h" // InitializeTempHivesForTesting | 28 #include "rlz/win/lib/rlz_lib.h" // InitializeTempHivesForTesting |
| 29 #elif defined(OS_MACOSX) | 29 #elif defined(OS_MACOSX) |
| 30 #include "rlz/lib/rlz_value_store.h" // SetRlzStoreDirectory | 30 #include "rlz/lib/rlz_value_store.h" // SetRlzStoreDirectory |
| 31 #endif | 31 #endif |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void InvokeDelayedInit(); | 167 void InvokeDelayedInit(); |
| 168 | 168 |
| 169 void ExpectEventRecorded(const char* event_name, bool expected); | 169 void ExpectEventRecorded(const char* event_name, bool expected); |
| 170 void ExpectRlzPingSent(bool expected); | 170 void ExpectRlzPingSent(bool expected); |
| 171 void ExpectReactivationRlzPingSent(bool expected); | 171 void ExpectReactivationRlzPingSent(bool expected); |
| 172 | 172 |
| 173 TestRLZTracker tracker_; | 173 TestRLZTracker tracker_; |
| 174 #if defined(OS_WIN) | 174 #if defined(OS_WIN) |
| 175 RegistryOverrideManager override_manager_; | 175 RegistryOverrideManager override_manager_; |
| 176 #elif defined(OS_MACOSX) | 176 #elif defined(OS_MACOSX) |
| 177 ScopedTempDir temp_dir_; | 177 base::ScopedTempDir temp_dir_; |
| 178 scoped_ptr<google_util::BrandForTesting> brand_override_; | 178 scoped_ptr<google_util::BrandForTesting> brand_override_; |
| 179 #endif | 179 #endif |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 void RlzLibTest::SetUp() { | 182 void RlzLibTest::SetUp() { |
| 183 testing::Test::SetUp(); | 183 testing::Test::SetUp(); |
| 184 | 184 |
| 185 #if defined(OS_WIN) | 185 #if defined(OS_WIN) |
| 186 // Before overriding HKLM for the tests, we need to set it up correctly | 186 // Before overriding HKLM for the tests, we need to set it up correctly |
| 187 // so that the rlz_lib calls work. This needs to be done before we do the | 187 // so that the rlz_lib calls work. This needs to be done before we do the |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 SetMainBrand("GGLS"); | 742 SetMainBrand("GGLS"); |
| 743 SetReactivationBrand("GGRS"); | 743 SetReactivationBrand("GGRS"); |
| 744 | 744 |
| 745 RLZTracker::InitRlzDelayed(true, 20, true, true, false); | 745 RLZTracker::InitRlzDelayed(true, 20, true, true, false); |
| 746 InvokeDelayedInit(); | 746 InvokeDelayedInit(); |
| 747 | 747 |
| 748 ExpectRlzPingSent(false); | 748 ExpectRlzPingSent(false); |
| 749 ExpectReactivationRlzPingSent(false); | 749 ExpectReactivationRlzPingSent(false); |
| 750 } | 750 } |
| 751 #endif // defined(OS_WIN) | 751 #endif // defined(OS_WIN) |
| OLD | NEW |