| 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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 class RenderThreadImplUnittest : public testing::Test { | 12 class RenderThreadImplUnittest : public testing::Test { |
| 13 public: | 13 public: |
| 14 RenderThreadImplUnittest() | 14 RenderThreadImplUnittest() |
| 15 : kCustomizableHistogram_("Histogram1"), | 15 : kCustomizableHistogram_("Histogram1"), |
| 16 kNormalHistogram_("Histogram2") {} | 16 kNormalHistogram_("Histogram2") {} |
| 17 virtual ~RenderThreadImplUnittest() {} | 17 virtual ~RenderThreadImplUnittest() {} |
| 18 protected: | 18 protected: |
| 19 virtual void SetUp() OVERRIDE { | 19 virtual void SetUp() override { |
| 20 histogram_customizer_.custom_histograms_.clear(); | 20 histogram_customizer_.custom_histograms_.clear(); |
| 21 histogram_customizer_.custom_histograms_.insert(kCustomizableHistogram_); | 21 histogram_customizer_.custom_histograms_.insert(kCustomizableHistogram_); |
| 22 } | 22 } |
| 23 RenderThreadImpl::HistogramCustomizer histogram_customizer_; | 23 RenderThreadImpl::HistogramCustomizer histogram_customizer_; |
| 24 const char* kCustomizableHistogram_; | 24 const char* kCustomizableHistogram_; |
| 25 const char* kNormalHistogram_; | 25 const char* kNormalHistogram_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 TEST_F(RenderThreadImplUnittest, CustomHistogramsWithNoNavigations) { | 28 TEST_F(RenderThreadImplUnittest, CustomHistogramsWithNoNavigations) { |
| 29 // First there is no page -> no custom histograms. | 29 // First there is no page -> no custom histograms. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 kCustomizableHistogram_)); | 73 kCustomizableHistogram_)); |
| 74 // After this point, there will never be a custom diagram again, even if the | 74 // After this point, there will never be a custom diagram again, even if the |
| 75 // view navigated back to the common host. | 75 // view navigated back to the common host. |
| 76 histogram_customizer_.RenderViewNavigatedToHost("mail.google.com", 2); | 76 histogram_customizer_.RenderViewNavigatedToHost("mail.google.com", 2); |
| 77 EXPECT_EQ(kCustomizableHistogram_, | 77 EXPECT_EQ(kCustomizableHistogram_, |
| 78 histogram_customizer_.ConvertToCustomHistogramName( | 78 histogram_customizer_.ConvertToCustomHistogramName( |
| 79 kCustomizableHistogram_)); | 79 kCustomizableHistogram_)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace content | 82 } // namespace content |
| OLD | NEW |