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

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

Issue 100823007: Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS page encodings Created 7 years 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 | Annotate | Revision Log
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" 10 #include "chrome/browser/extensions/activity_log/activity_action_constants.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 static void RetrieveActions_ArgUrlExtraction( 112 static void RetrieveActions_ArgUrlExtraction(
113 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { 113 scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
114 const DictionaryValue* other = NULL; 114 const DictionaryValue* other = NULL;
115 int dom_verb = -1; 115 int dom_verb = -1;
116 116
117 ASSERT_EQ(4U, i->size()); 117 ASSERT_EQ(4U, i->size());
118 scoped_refptr<Action> action = i->at(0); 118 scoped_refptr<Action> action = i->at(0);
119 ASSERT_EQ("XMLHttpRequest.open", action->api_name()); 119 ASSERT_EQ("XMLHttpRequest.open", action->api_name());
120 ASSERT_EQ("[\"POST\",\"\\u003Carg_url\\u003E\"]", 120 ASSERT_EQ("[\"POST\",\"\\u003Carg_url>\"]",
121 ActivityLogPolicy::Util::Serialize(action->args())); 121 ActivityLogPolicy::Util::Serialize(action->args()));
122 ASSERT_EQ("http://api.google.com/", action->arg_url().spec()); 122 ASSERT_EQ("http://api.google.com/", action->arg_url().spec());
123 // Test that the dom_verb field was changed to XHR (from METHOD). This 123 // Test that the dom_verb field was changed to XHR (from METHOD). This
124 // could be tested on all retrieved XHR actions but it would be redundant, 124 // could be tested on all retrieved XHR actions but it would be redundant,
125 // so just test once. 125 // so just test once.
126 other = action->other(); 126 other = action->other();
127 ASSERT_TRUE(other); 127 ASSERT_TRUE(other);
128 ASSERT_TRUE(other->GetInteger(activity_log_constants::kActionDomVerb, 128 ASSERT_TRUE(other->GetInteger(activity_log_constants::kActionDomVerb,
129 &dom_verb)); 129 &dom_verb));
130 ASSERT_EQ(DomActionType::XHR, dom_verb); 130 ASSERT_EQ(DomActionType::XHR, dom_verb);
131 131
132 action = i->at(1); 132 action = i->at(1);
133 ASSERT_EQ("XMLHttpRequest.open", action->api_name()); 133 ASSERT_EQ("XMLHttpRequest.open", action->api_name());
134 ASSERT_EQ("[\"POST\",\"\\u003Carg_url\\u003E\"]", 134 ASSERT_EQ("[\"POST\",\"\\u003Carg_url>\"]",
135 ActivityLogPolicy::Util::Serialize(action->args())); 135 ActivityLogPolicy::Util::Serialize(action->args()));
136 ASSERT_EQ("http://www.google.com/api/", action->arg_url().spec()); 136 ASSERT_EQ("http://www.google.com/api/", action->arg_url().spec());
137 137
138 action = i->at(2); 138 action = i->at(2);
139 ASSERT_EQ("XMLHttpRequest.open", action->api_name()); 139 ASSERT_EQ("XMLHttpRequest.open", action->api_name());
140 ASSERT_EQ("[\"POST\",\"/api/\"]", 140 ASSERT_EQ("[\"POST\",\"/api/\"]",
141 ActivityLogPolicy::Util::Serialize(action->args())); 141 ActivityLogPolicy::Util::Serialize(action->args()));
142 ASSERT_FALSE(action->arg_url().is_valid()); 142 ASSERT_FALSE(action->arg_url().is_valid());
143 143
144 action = i->at(3); 144 action = i->at(3);
145 ASSERT_EQ("windows.create", action->api_name()); 145 ASSERT_EQ("windows.create", action->api_name());
146 ASSERT_EQ("[{\"url\":\"\\u003Carg_url\\u003E\"}]", 146 ASSERT_EQ("[{\"url\":\"\\u003Carg_url>\"}]",
147 ActivityLogPolicy::Util::Serialize(action->args())); 147 ActivityLogPolicy::Util::Serialize(action->args()));
148 ASSERT_EQ("http://www.google.co.uk/", action->arg_url().spec()); 148 ASSERT_EQ("http://www.google.co.uk/", action->arg_url().spec());
149 } 149 }
150 150
151 ExtensionService* extension_service_; 151 ExtensionService* extension_service_;
152 152
153 #if defined OS_CHROMEOS 153 #if defined OS_CHROMEOS
154 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 154 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
155 chromeos::ScopedTestCrosSettings test_cros_settings_; 155 chromeos::ScopedTestCrosSettings test_cros_settings_;
156 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; 156 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 extension->id(), 334 extension->id(),
335 Action::ACTION_ANY, 335 Action::ACTION_ANY,
336 "", 336 "",
337 "", 337 "",
338 "", 338 "",
339 -1, 339 -1,
340 base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions0)); 340 base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions0));
341 } 341 }
342 342
343 } // namespace extensions 343 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698