Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 5 #include <utility>
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" 8 #include "chrome/browser/extensions/activity_log/activity_action_constants.h"
9 #include "chrome/browser/extensions/activity_log/activity_actions.h" 9 #include "chrome/browser/extensions/activity_log/activity_actions.h"
10 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" 10 #include "chrome/browser/extensions/activity_log/activity_log_policy.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Test that WebRequest details are stripped for privacy. 42 // Test that WebRequest details are stripped for privacy.
43 TEST_F(ActivityLogPolicyUtilTest, StripPrivacySensitiveWebRequest) { 43 TEST_F(ActivityLogPolicyUtilTest, StripPrivacySensitiveWebRequest) {
44 scoped_refptr<Action> action = new Action( 44 scoped_refptr<Action> action = new Action(
45 "punky", base::Time::Now(), Action::ACTION_WEB_REQUEST, "webRequest"); 45 "punky", base::Time::Now(), Action::ACTION_WEB_REQUEST, "webRequest");
46 action->mutable_other()->Set( 46 action->mutable_other()->Set(
47 activity_log_constants::kActionWebRequest, 47 activity_log_constants::kActionWebRequest,
48 DictionaryBuilder() 48 DictionaryBuilder()
49 .Set(activity_log_web_request_constants::kNewUrlKey, 49 .Set(activity_log_web_request_constants::kNewUrlKey,
50 "http://www.youtube.com/") 50 "http://www.youtube.com/")
51 .Set(activity_log_web_request_constants::kAddedRequestHeadersKey, 51 .Set(activity_log_web_request_constants::kAddedRequestHeadersKey,
52 std::move(ListBuilder().Append("arg"))) 52 ListBuilder().Append("arg").Build())
53 .Build() 53 .Build());
54 .release());
Nico 2016/02/27 03:33:00 did you drop the release() intentionally?
dcheng 2016/02/27 03:39:30 Yep, this method has two overloads: a scoped_ptr o
55 54
56 ActivityLogPolicy::Util::StripPrivacySensitiveFields(action); 55 ActivityLogPolicy::Util::StripPrivacySensitiveFields(action);
57 56
58 ASSERT_EQ( 57 ASSERT_EQ(
59 "{\"web_request\":{\"added_request_headers\":true,\"new_url\":true}}", 58 "{\"web_request\":{\"added_request_headers\":true,\"new_url\":true}}",
60 ActivityLogPolicy::Util::Serialize(action->other())); 59 ActivityLogPolicy::Util::Serialize(action->other()));
61 } 60 }
62 61
63 // Test that argument values are stripped as appropriate. 62 // Test that argument values are stripped as appropriate.
64 TEST_F(ActivityLogPolicyUtilTest, StripArguments) { 63 TEST_F(ActivityLogPolicyUtilTest, StripArguments) {
(...skipping 25 matching lines...) Expand all
90 new Action("punky", 89 new Action("punky",
91 base::Time::Now(), 90 base::Time::Now(),
92 Action::ACTION_API_CALL, 91 Action::ACTION_API_CALL,
93 "tabs.executeScript"); 92 "tabs.executeScript");
94 action->ParsePageUrl("<incognito>http://www.google.com/"); 93 action->ParsePageUrl("<incognito>http://www.google.com/");
95 EXPECT_EQ("http://www.google.com/", action->page_url().spec()); 94 EXPECT_EQ("http://www.google.com/", action->page_url().spec());
96 EXPECT_TRUE(action->page_incognito()); 95 EXPECT_TRUE(action->page_incognito());
97 } 96 }
98 97
99 } // namespace extensions 98 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698