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

Side by Side Diff: chrome/browser/metrics/metrics_memory_details_browsertest.cc

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/metrics/metrics_memory_details.h" 5 #include "chrome/browser/metrics/metrics_memory_details.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 10 matching lines...) Expand all
21 StartFetch(FROM_CHROME_ONLY); 21 StartFetch(FROM_CHROME_ONLY);
22 content::RunMessageLoop(); 22 content::RunMessageLoop();
23 } 23 }
24 24
25 private: 25 private:
26 ~TestMemoryDetails() override {} 26 ~TestMemoryDetails() override {}
27 27
28 void OnDetailsAvailable() override { 28 void OnDetailsAvailable() override {
29 MetricsMemoryDetails::OnDetailsAvailable(); 29 MetricsMemoryDetails::OnDetailsAvailable();
30 // Exit the loop initiated by StartFetchAndWait(). 30 // Exit the loop initiated by StartFetchAndWait().
31 base::MessageLoop::current()->Quit(); 31 base::MessageLoop::current()->QuitWhenIdle();
32 } 32 }
33 33
34 DISALLOW_COPY_AND_ASSIGN(TestMemoryDetails); 34 DISALLOW_COPY_AND_ASSIGN(TestMemoryDetails);
35 }; 35 };
36 36
37 } // namespace 37 } // namespace
38 38
39 class MetricsMemoryDetailsBrowserTest : public InProcessBrowserTest { 39 class MetricsMemoryDetailsBrowserTest : public InProcessBrowserTest {
40 public: 40 public:
41 MetricsMemoryDetailsBrowserTest() {} 41 MetricsMemoryDetailsBrowserTest() {}
42 ~MetricsMemoryDetailsBrowserTest() override {} 42 ~MetricsMemoryDetailsBrowserTest() override {}
43 43
44 private: 44 private:
45 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetailsBrowserTest); 45 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetailsBrowserTest);
46 }; 46 };
47 47
48 IN_PROC_BROWSER_TEST_F(MetricsMemoryDetailsBrowserTest, TestMemoryDetails) { 48 IN_PROC_BROWSER_TEST_F(MetricsMemoryDetailsBrowserTest, TestMemoryDetails) {
49 base::HistogramTester histogram_tester; 49 base::HistogramTester histogram_tester;
50 50
51 scoped_refptr<TestMemoryDetails> details(new TestMemoryDetails); 51 scoped_refptr<TestMemoryDetails> details(new TestMemoryDetails);
52 details->StartFetchAndWait(); 52 details->StartFetchAndWait();
53 53
54 // Memory.Browser histogram should have a single non-0 sample recorded. 54 // Memory.Browser histogram should have a single non-0 sample recorded.
55 histogram_tester.ExpectTotalCount("Memory.Browser", 1); 55 histogram_tester.ExpectTotalCount("Memory.Browser", 1);
56 scoped_ptr<base::HistogramSamples> samples( 56 scoped_ptr<base::HistogramSamples> samples(
57 histogram_tester.GetHistogramSamplesSinceCreation("Memory.Browser")); 57 histogram_tester.GetHistogramSamplesSinceCreation("Memory.Browser"));
58 ASSERT_TRUE(samples); 58 ASSERT_TRUE(samples);
59 EXPECT_NE(0, samples->sum()); 59 EXPECT_NE(0, samples->sum());
60 } 60 }
OLDNEW
« no previous file with comments | « chrome/browser/media/native_desktop_media_list_unittest.cc ('k') | chrome/browser/metrics/thread_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698