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

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

Issue 23449016: Update tests to check fields directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/activity_log/counting_policy_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/cancelable_callback.h" 5 #include "base/cancelable_callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ASSERT_EQ(2, static_cast<int>(i->size())); 157 ASSERT_EQ(2, static_cast<int>(i->size()));
158 } 158 }
159 159
160 static void RetrieveActions_FetchFilteredActions300( 160 static void RetrieveActions_FetchFilteredActions300(
161 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { 161 scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
162 ASSERT_EQ(300, static_cast<int>(i->size())); 162 ASSERT_EQ(300, static_cast<int>(i->size()));
163 } 163 }
164 164
165 static void Arguments_Present(scoped_ptr<Action::ActionVector> i) { 165 static void Arguments_Present(scoped_ptr<Action::ActionVector> i) {
166 scoped_refptr<Action> last = i->front(); 166 scoped_refptr<Action> last = i->front();
167 std::string args = 167 CheckAction(*last, "odlameecjipmbmbejkplpemijjgpljce",
168 "ID=odlameecjipmbmbejkplpemijjgpljce CATEGORY=api_call " 168 Action::ACTION_API_CALL, "extension.connect",
169 "API=extension.connect ARGS=[\"hello\",\"world\"]"; 169 "[\"hello\",\"world\"]", "", "", "");
170 ASSERT_EQ(args, last->PrintForDebug());
171 } 170 }
172 171
173 static void Arguments_GetTodaysActions( 172 static void Arguments_GetTodaysActions(
174 scoped_ptr<Action::ActionVector> actions) { 173 scoped_ptr<Action::ActionVector> actions) {
175 std::string api_print =
176 "ID=punky CATEGORY=api_call API=brewster ARGS=[\"woof\"] "
177 "PAGE_TITLE=\"Page Title\" ARG_URL=http://www.arg-url.com/";
178 std::string dom_print =
179 "ID=punky CATEGORY=dom_access API=lets ARGS=[\"vamoose\"] "
180 "PAGE_URL=http://www.google.com/ PAGE_TITLE=\"Page Title\" "
181 "ARG_URL=http://www.arg-url.com/";
182 ASSERT_EQ(2, static_cast<int>(actions->size())); 174 ASSERT_EQ(2, static_cast<int>(actions->size()));
183 ASSERT_EQ(dom_print, actions->at(0)->PrintForDebug()); 175 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
184 ASSERT_EQ(api_print, actions->at(1)->PrintForDebug()); 176 "[\"vamoose\"]", "http://www.google.com/", "Page Title",
177 "http://www.arg-url.com/");
178 CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster",
179 "[\"woof\"]", "", "Page Title", "http://www.arg-url.com/");
185 } 180 }
186 181
187 static void Arguments_GetOlderActions( 182 static void Arguments_GetOlderActions(
188 scoped_ptr<Action::ActionVector> actions) { 183 scoped_ptr<Action::ActionVector> actions) {
189 std::string api_print =
190 "ID=punky CATEGORY=api_call API=brewster ARGS=[\"woof\"]";
191 std::string dom_print =
192 "ID=punky CATEGORY=dom_access API=lets ARGS=[\"vamoose\"] "
193 "PAGE_URL=http://www.google.com/";
194 ASSERT_EQ(2, static_cast<int>(actions->size())); 184 ASSERT_EQ(2, static_cast<int>(actions->size()));
195 ASSERT_EQ(dom_print, actions->at(0)->PrintForDebug()); 185 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
196 ASSERT_EQ(api_print, actions->at(1)->PrintForDebug()); 186 "[\"vamoose\"]", "http://www.google.com/", "", "");
187 CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster",
188 "[\"woof\"]", "", "", "");
197 } 189 }
198 190
199 static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) { 191 static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
200 ASSERT_EQ(2, static_cast<int>(actions->size())); 192 ASSERT_EQ(2, static_cast<int>(actions->size()));
201 CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "lets", 193 CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "lets",
202 "[\"vamoose\"]", "", "", ""); 194 "[\"vamoose\"]", "", "", "");
203 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets", 195 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
204 "[\"vamoose\"]", "", "", ""); 196 "[\"vamoose\"]", "", "", "");
205 } 197 }
206 198
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 Action::ACTION_ANY, 659 Action::ACTION_ANY,
668 "", 660 "",
669 "", 661 "",
670 "", 662 "",
671 base::Bind( 663 base::Bind(
672 &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions300)); 664 &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions300));
673 policy->Close(); 665 policy->Close();
674 } 666 }
675 667
676 } // namespace extensions 668 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_log/counting_policy_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698