OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/rappor/rappor_recorder.h" |
| 6 #include "components/rappor/rappor.h" |
| 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace rappor { |
| 11 |
| 12 TEST(RapporRecorderTest, TestRecorder) { |
| 13 RapporRecorder recorder; |
| 14 |
| 15 Rappor* rappor = recorder.GetRappor("MyRappor"); |
| 16 ASSERT_TRUE(rappor); |
| 17 |
| 18 Rappor* rappor2 = recorder.GetRappor("MyRappor2"); |
| 19 ASSERT_NE(rappor, rappor2); |
| 20 |
| 21 Rappor* rappor1 = recorder.GetRappor("MyRappor"); |
| 22 ASSERT_EQ(rappor, rappor1); |
| 23 |
| 24 RapporRecorder::Rappors rappors; |
| 25 recorder.GetRappors(&rappors); |
| 26 ASSERT_EQ(rappors.size(), 2u); |
| 27 |
| 28 recorder.ClearRappors(); |
| 29 RapporRecorder::Rappors rappors_cleared; |
| 30 recorder.GetRappors(&rappors_cleared); |
| 31 ASSERT_EQ(rappors_cleared.size(), 0u); |
| 32 } |
| 33 |
| 34 } // namespace rappor |
OLD | NEW |