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

Side by Side Diff: chrome/browser/data_usage/tab_id_annotator_unittest.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/data_usage/tab_id_annotator.h" 5 #include "chrome/browser/data_usage/tab_id_annotator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8
9 #include <string> 8 #include <string>
9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/sessions/session_tab_helper.h" 18 #include "chrome/browser/sessions/session_tab_helper.h"
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 EXPECT_EQ(expected->tab_id, actual->tab_id); 63 EXPECT_EQ(expected->tab_id, actual->tab_id);
64 EXPECT_EQ(*expected, *actual); 64 EXPECT_EQ(*expected, *actual);
65 } 65 }
66 66
67 // Expects that |expected| and |actual| are equal, then quits |ui_run_loop| on 67 // Expects that |expected| and |actual| are equal, then quits |ui_run_loop| on
68 // the UI thread. 68 // the UI thread.
69 void ExpectDataUseAndQuit(base::RunLoop* ui_run_loop, 69 void ExpectDataUseAndQuit(base::RunLoop* ui_run_loop,
70 scoped_ptr<DataUse> expected, 70 scoped_ptr<DataUse> expected,
71 scoped_ptr<DataUse> actual) { 71 scoped_ptr<DataUse> actual) {
72 DCHECK(ui_run_loop); 72 DCHECK(ui_run_loop);
73 ExpectDataUse(expected.Pass(), actual.Pass()); 73 ExpectDataUse(std::move(expected), std::move(actual));
74 74
75 // This can't use run_loop->QuitClosure here because that uses WeakPtrs, which 75 // This can't use run_loop->QuitClosure here because that uses WeakPtrs, which
76 // aren't thread safe. 76 // aren't thread safe.
77 BrowserThread::PostTask( 77 BrowserThread::PostTask(
78 BrowserThread::UI, FROM_HERE, 78 BrowserThread::UI, FROM_HERE,
79 base::Bind(&base::RunLoop::Quit, base::Unretained(ui_run_loop))); 79 base::Bind(&base::RunLoop::Quit, base::Unretained(ui_run_loop)));
80 } 80 }
81 81
82 // Tests that for a sample URLRequest, associated with the given 82 // Tests that for a sample URLRequest, associated with the given
83 // |render_process_id| and |render_frame_id|, repeatedly annotating DataUse for 83 // |render_process_id| and |render_frame_id|, repeatedly annotating DataUse for
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 base::Bind(&TestAnnotateOnIOThread, &ui_run_loop, 162 base::Bind(&TestAnnotateOnIOThread, &ui_run_loop,
163 web_contents()->GetMainFrame()->GetProcess()->GetID(), 163 web_contents()->GetMainFrame()->GetProcess()->GetID(),
164 web_contents()->GetMainFrame()->GetRoutingID(), 164 web_contents()->GetMainFrame()->GetRoutingID(),
165 expected_tab_id)); 165 expected_tab_id));
166 ui_run_loop.Run(); 166 ui_run_loop.Run();
167 } 167 }
168 168
169 } // namespace 169 } // namespace
170 170
171 } // namespace chrome_browser_data_usage 171 } // namespace chrome_browser_data_usage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698