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/values.h" | 5 #include "base/values.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/activity_actions.h" | 7 #include "chrome/browser/extensions/activity_log/activity_actions.h" |
8 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" | 8 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" |
9 #include "chrome/browser/extensions/activity_log/web_request_constants.h" | 9 #include "chrome/browser/extensions/activity_log/web_request_constants.h" |
10 #include "chrome/common/extensions/value_builder.h" | 10 #include "chrome/common/extensions/value_builder.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 action->set_page_url(GURL("http://www.google.com/")); | 25 action->set_page_url(GURL("http://www.google.com/")); |
26 action->set_page_incognito(true); | 26 action->set_page_incognito(true); |
27 action->set_page_title("private"); | 27 action->set_page_title("private"); |
28 action->set_arg_url(GURL("http://www.youtube.com/?privatekey")); | 28 action->set_arg_url(GURL("http://www.youtube.com/?privatekey")); |
29 | 29 |
30 ASSERT_EQ("<incognito>http://www.google.com/", action->SerializePageUrl()); | 30 ASSERT_EQ("<incognito>http://www.google.com/", action->SerializePageUrl()); |
31 | 31 |
32 ActivityLogPolicy::Util::StripPrivacySensitiveFields(action); | 32 ActivityLogPolicy::Util::StripPrivacySensitiveFields(action); |
33 | 33 |
34 ASSERT_FALSE(action->page_url().is_valid()); | 34 ASSERT_FALSE(action->page_url().is_valid()); |
35 ASSERT_EQ("<incognito>", action->SerializePageUrl()); | 35 ASSERT_EQ("", action->SerializePageUrl()); |
36 ASSERT_EQ("", action->page_title()); | 36 ASSERT_EQ("", action->page_title()); |
37 ASSERT_EQ("http://www.youtube.com/", action->arg_url().spec()); | 37 ASSERT_EQ("http://www.youtube.com/", action->arg_url().spec()); |
38 } | 38 } |
39 | 39 |
40 // Test that WebRequest details are stripped for privacy. | 40 // Test that WebRequest details are stripped for privacy. |
41 TEST_F(ActivityLogPolicyUtilTest, StripPrivacySensitiveWebRequest) { | 41 TEST_F(ActivityLogPolicyUtilTest, StripPrivacySensitiveWebRequest) { |
42 scoped_refptr<Action> action = new Action( | 42 scoped_refptr<Action> action = new Action( |
43 "punky", base::Time::Now(), Action::ACTION_WEB_REQUEST, "webRequest"); | 43 "punky", base::Time::Now(), Action::ACTION_WEB_REQUEST, "webRequest"); |
44 action->mutable_other()->Set( | 44 action->mutable_other()->Set( |
45 activity_log_constants::kActionWebRequest, | 45 activity_log_constants::kActionWebRequest, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 new Action("punky", | 93 new Action("punky", |
94 base::Time::Now(), | 94 base::Time::Now(), |
95 Action::ACTION_API_CALL, | 95 Action::ACTION_API_CALL, |
96 "tabs.executeScript"); | 96 "tabs.executeScript"); |
97 action->ParsePageUrl("<incognito>http://www.google.com/"); | 97 action->ParsePageUrl("<incognito>http://www.google.com/"); |
98 EXPECT_EQ("http://www.google.com/", action->page_url().spec()); | 98 EXPECT_EQ("http://www.google.com/", action->page_url().spec()); |
99 EXPECT_TRUE(action->page_incognito()); | 99 EXPECT_TRUE(action->page_incognito()); |
100 } | 100 } |
101 | 101 |
102 } // namespace extensions | 102 } // namespace extensions |
OLD | NEW |