| 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 "components/rlz/rlz_tracker.h" | 5 #include "components/rlz/rlz_tracker.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/test/sequenced_worker_pool_owner.h" | 14 #include "base/test/sequenced_worker_pool_owner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 15 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 16 #include "components/rlz/rlz_tracker_delegate.h" | 18 #include "components/rlz/rlz_tracker_delegate.h" |
| 17 #include "net/url_request/url_request_test_util.h" | 19 #include "net/url_request/url_request_test_util.h" |
| 18 #include "rlz/test/rlz_test_helpers.h" | 20 #include "rlz/test/rlz_test_helpers.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 void SimulateHomepageUsage(); | 252 void SimulateHomepageUsage(); |
| 251 void SimulateAppListUsage(); | 253 void SimulateAppListUsage(); |
| 252 void InvokeDelayedInit(); | 254 void InvokeDelayedInit(); |
| 253 | 255 |
| 254 void ExpectEventRecorded(const char* event_name, bool expected); | 256 void ExpectEventRecorded(const char* event_name, bool expected); |
| 255 void ExpectRlzPingSent(bool expected); | 257 void ExpectRlzPingSent(bool expected); |
| 256 void ExpectReactivationRlzPingSent(bool expected); | 258 void ExpectReactivationRlzPingSent(bool expected); |
| 257 | 259 |
| 258 base::MessageLoop message_loop_; | 260 base::MessageLoop message_loop_; |
| 259 TestRLZTrackerDelegate* delegate_; | 261 TestRLZTrackerDelegate* delegate_; |
| 260 scoped_ptr<TestRLZTracker> tracker_; | 262 std::unique_ptr<TestRLZTracker> tracker_; |
| 261 RlzLibTestNoMachineStateHelper m_rlz_test_helper_; | 263 RlzLibTestNoMachineStateHelper m_rlz_test_helper_; |
| 262 }; | 264 }; |
| 263 | 265 |
| 264 void RlzLibTest::SetUp() { | 266 void RlzLibTest::SetUp() { |
| 265 testing::Test::SetUp(); | 267 testing::Test::SetUp(); |
| 266 m_rlz_test_helper_.SetUp(); | 268 m_rlz_test_helper_.SetUp(); |
| 267 | 269 |
| 268 delegate_ = new TestRLZTrackerDelegate; | 270 delegate_ = new TestRLZTrackerDelegate; |
| 269 tracker_.reset(new TestRLZTracker()); | 271 tracker_.reset(new TestRLZTracker()); |
| 270 RLZTracker::SetRlzDelegate(make_scoped_ptr(delegate_)); | 272 RLZTracker::SetRlzDelegate(base::WrapUnique(delegate_)); |
| 271 | 273 |
| 272 // Make sure a non-organic brand code is set in the registry or the RLZTracker | 274 // Make sure a non-organic brand code is set in the registry or the RLZTracker |
| 273 // is pretty much a no-op. | 275 // is pretty much a no-op. |
| 274 SetMainBrand("TEST"); | 276 SetMainBrand("TEST"); |
| 275 SetReactivationBrand(""); | 277 SetReactivationBrand(""); |
| 276 } | 278 } |
| 277 | 279 |
| 278 void RlzLibTest::TearDown() { | 280 void RlzLibTest::TearDown() { |
| 279 delegate_ = nullptr; | 281 delegate_ = nullptr; |
| 280 tracker_.reset(); | 282 tracker_.reset(); |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 1002 |
| 1001 ExpectEventRecorded(OmniboxFirstSearch(), true); | 1003 ExpectEventRecorded(OmniboxFirstSearch(), true); |
| 1002 | 1004 |
| 1003 RLZTracker::ClearRlzState(); | 1005 RLZTracker::ClearRlzState(); |
| 1004 | 1006 |
| 1005 ExpectEventRecorded(OmniboxFirstSearch(), false); | 1007 ExpectEventRecorded(OmniboxFirstSearch(), false); |
| 1006 } | 1008 } |
| 1007 #endif // defined(OS_CHROMEOS) | 1009 #endif // defined(OS_CHROMEOS) |
| 1008 | 1010 |
| 1009 } // namespace rlz | 1011 } // namespace rlz |
| OLD | NEW |