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

Side by Side Diff: chrome/browser/safe_browsing/protocol_manager_unittest.cc

Issue 1100223002: Update {virtual,override} to follow C++11 style in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 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 (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 5
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 pm->NextChunkUrl(url_https_full).spec()); 308 pm->NextChunkUrl(url_https_full).spec());
309 EXPECT_EQ("https://localhost:1234/foo/bar?additional_query", 309 EXPECT_EQ("https://localhost:1234/foo/bar?additional_query",
310 pm->NextChunkUrl(url_https_no_query).spec()); 310 pm->NextChunkUrl(url_https_no_query).spec());
311 } 311 }
312 312
313 namespace { 313 namespace {
314 314
315 class MockProtocolDelegate : public SafeBrowsingProtocolManagerDelegate { 315 class MockProtocolDelegate : public SafeBrowsingProtocolManagerDelegate {
316 public: 316 public:
317 MockProtocolDelegate() {} 317 MockProtocolDelegate() {}
318 virtual ~MockProtocolDelegate() {} 318 ~MockProtocolDelegate() override {}
319 319
320 MOCK_METHOD0(UpdateStarted, void()); 320 MOCK_METHOD0(UpdateStarted, void());
321 MOCK_METHOD1(UpdateFinished, void(bool)); 321 MOCK_METHOD1(UpdateFinished, void(bool));
322 MOCK_METHOD0(ResetDatabase, void()); 322 MOCK_METHOD0(ResetDatabase, void());
323 MOCK_METHOD1(GetChunks, void(GetChunksCallback)); 323 MOCK_METHOD1(GetChunks, void(GetChunksCallback));
324 324
325 // gmock does not work with scoped_ptr<> at this time. Add a local method to 325 // gmock does not work with scoped_ptr<> at this time. Add a local method to
326 // mock, then call that from an override. Beware of object ownership when 326 // mock, then call that from an override. Beware of object ownership when
327 // making changes here. 327 // making changes here.
328 MOCK_METHOD3(AddChunksRaw, void(const std::string& lists, 328 MOCK_METHOD3(AddChunksRaw, void(const std::string& lists,
329 const ScopedVector<SBChunkData>& chunks, 329 const ScopedVector<SBChunkData>& chunks,
330 AddChunksCallback)); 330 AddChunksCallback));
331 virtual void AddChunks(const std::string& list, 331 void AddChunks(const std::string& list,
332 scoped_ptr<ScopedVector<SBChunkData> > chunks, 332 scoped_ptr<ScopedVector<SBChunkData>> chunks,
333 AddChunksCallback callback) override { 333 AddChunksCallback callback) override {
334 AddChunksRaw(list, *chunks, callback); 334 AddChunksRaw(list, *chunks, callback);
335 } 335 }
336 336
337 // TODO(shess): Actually test this case somewhere. 337 // TODO(shess): Actually test this case somewhere.
338 MOCK_METHOD1(DeleteChunksRaw, 338 MOCK_METHOD1(DeleteChunksRaw,
339 void(const std::vector<SBChunkDelete>& chunk_deletes)); 339 void(const std::vector<SBChunkDelete>& chunk_deletes));
340 virtual void DeleteChunks( 340 void DeleteChunks(
341 scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes) override{ 341 scoped_ptr<std::vector<SBChunkDelete>> chunk_deletes) override {
342 DeleteChunksRaw(*chunk_deletes); 342 DeleteChunksRaw(*chunk_deletes);
343 } 343 }
344 }; 344 };
345 345
346 // |InvokeGetChunksCallback| is required because GMock's InvokeArgument action 346 // |InvokeGetChunksCallback| is required because GMock's InvokeArgument action
347 // expects to use operator(), and a Callback only provides Run(). 347 // expects to use operator(), and a Callback only provides Run().
348 // TODO(cbentzel): Use ACTION or ACTION_TEMPLATE instead? 348 // TODO(cbentzel): Use ACTION or ACTION_TEMPLATE instead?
349 void InvokeGetChunksCallback( 349 void InvokeGetChunksCallback(
350 const std::vector<SBListChunkRanges>& ranges, 350 const std::vector<SBListChunkRanges>& ranges,
351 bool database_error, 351 bool database_error,
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 second_chunk_url_fetcher->delegate()->OnURLFetchComplete( 1126 second_chunk_url_fetcher->delegate()->OnURLFetchComplete(
1127 second_chunk_url_fetcher); 1127 second_chunk_url_fetcher);
1128 1128
1129 EXPECT_FALSE(pm->IsUpdateScheduled()); 1129 EXPECT_FALSE(pm->IsUpdateScheduled());
1130 1130
1131 // Invoke the AddChunksCallback to finish the update. 1131 // Invoke the AddChunksCallback to finish the update.
1132 runner->RunPendingTasks(); 1132 runner->RunPendingTasks();
1133 1133
1134 EXPECT_TRUE(pm->IsUpdateScheduled()); 1134 EXPECT_TRUE(pm->IsUpdateScheduled());
1135 } 1135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698