OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" | 6 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" |
7 #include "chrome/browser/extensions/activity_log/uma_policy.h" | 7 #include "chrome/browser/extensions/activity_log/uma_policy.h" |
8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
9 #include "extensions/common/dom_action_types.h" | 9 #include "extensions/common/dom_action_types.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 policy->SetupOpenedPage(site3); | 102 policy->SetupOpenedPage(site3); |
103 policy->SetupOpenedPage(site3); | 103 policy->SetupOpenedPage(site3); |
104 | 104 |
105 // Check that site1, site2, and site3 were recorded. | 105 // Check that site1, site2, and site3 were recorded. |
106 ASSERT_EQ(3u, policy->url_status().size()); | 106 ASSERT_EQ(3u, policy->url_status().size()); |
107 ASSERT_EQ(1, policy->url_status()[site1][UmaPolicy::kNumberOfTabs]); | 107 ASSERT_EQ(1, policy->url_status()[site1][UmaPolicy::kNumberOfTabs]); |
108 ASSERT_EQ(2, policy->url_status()[site2][UmaPolicy::kNumberOfTabs]); | 108 ASSERT_EQ(2, policy->url_status()[site2][UmaPolicy::kNumberOfTabs]); |
109 ASSERT_EQ(3, policy->url_status()[site3][UmaPolicy::kNumberOfTabs]); | 109 ASSERT_EQ(3, policy->url_status()[site3][UmaPolicy::kNumberOfTabs]); |
110 | 110 |
111 // Remove some sites. | 111 // Remove some sites. |
112 policy->CleanupClosedPage(site0); | 112 policy->CleanupClosedPage(site0, NULL); |
113 policy->CleanupClosedPage(site2); | 113 policy->CleanupClosedPage(site2, NULL); |
114 policy->CleanupClosedPage(site2); | 114 policy->CleanupClosedPage(site2, NULL); |
115 policy->CleanupClosedPage(site3); | 115 policy->CleanupClosedPage(site3, NULL); |
116 | 116 |
117 // Check that the removal worked. | 117 // Check that the removal worked. |
118 ASSERT_EQ(2u, policy->url_status().size()); | 118 ASSERT_EQ(2u, policy->url_status().size()); |
119 ASSERT_EQ(1, policy->url_status()[site1][UmaPolicy::kNumberOfTabs]); | 119 ASSERT_EQ(1, policy->url_status()[site1][UmaPolicy::kNumberOfTabs]); |
120 ASSERT_EQ(2, policy->url_status()[site3][UmaPolicy::kNumberOfTabs]); | 120 ASSERT_EQ(2, policy->url_status()[site3][UmaPolicy::kNumberOfTabs]); |
121 | 121 |
122 policy->Close(); | 122 policy->Close(); |
123 } | 123 } |
124 | 124 |
125 TEST_F(UmaPolicyTest, ProcessActionTest) { | 125 TEST_F(UmaPolicyTest, ProcessActionTest) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 UmaPolicy::CleanURL(GURL("http://www.cnn.com"))); | 216 UmaPolicy::CleanURL(GURL("http://www.cnn.com"))); |
217 ASSERT_EQ("http://www.cnn.com/", | 217 ASSERT_EQ("http://www.cnn.com/", |
218 UmaPolicy::CleanURL(GURL("http://www.cnn.com/#a"))); | 218 UmaPolicy::CleanURL(GURL("http://www.cnn.com/#a"))); |
219 ASSERT_EQ("http://www.cnn.com/", | 219 ASSERT_EQ("http://www.cnn.com/", |
220 UmaPolicy::CleanURL(GURL("http://www.cnn.com/#aaaa"))); | 220 UmaPolicy::CleanURL(GURL("http://www.cnn.com/#aaaa"))); |
221 ASSERT_EQ("http://www.cnn.com/?q=a", | 221 ASSERT_EQ("http://www.cnn.com/?q=a", |
222 UmaPolicy::CleanURL(GURL("http://www.cnn.com/?q=a"))); | 222 UmaPolicy::CleanURL(GURL("http://www.cnn.com/?q=a"))); |
223 } | 223 } |
224 | 224 |
225 } // namespace extensions | 225 } // namespace extensions |
OLD | NEW |