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

Side by Side Diff: content/browser/battery_status/battery_status_browsertest.cc

Issue 633543002: Replace OVERRIDE and FINAL with override and final in content/browser/battery_status[a-s]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | content/browser/battery_status/battery_status_manager_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/synchronization/waitable_event.h" 6 #include "base/synchronization/waitable_event.h"
7 #include "content/browser/battery_status/battery_status_manager.h" 7 #include "content/browser/battery_status/battery_status_manager.h"
8 #include "content/browser/battery_status/battery_status_service.h" 8 #include "content/browser/battery_status/battery_status_service.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "content/public/test/content_browser_test.h" 11 #include "content/public/test/content_browser_test.h"
12 #include "content/public/test/content_browser_test_utils.h" 12 #include "content/public/test/content_browser_test_utils.h"
13 #include "content/public/test/test_navigation_observer.h" 13 #include "content/public/test/test_navigation_observer.h"
14 #include "content/public/test/test_utils.h" 14 #include "content/public/test/test_utils.h"
15 #include "content/shell/browser/shell.h" 15 #include "content/shell/browser/shell.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 namespace { 19 namespace {
20 20
21 class FakeBatteryManager : public BatteryStatusManager { 21 class FakeBatteryManager : public BatteryStatusManager {
22 public: 22 public:
23 explicit FakeBatteryManager( 23 explicit FakeBatteryManager(
24 const BatteryStatusService::BatteryUpdateCallback& callback) 24 const BatteryStatusService::BatteryUpdateCallback& callback)
25 : callback_(callback), battery_status_available_(true), started_(false) {} 25 : callback_(callback), battery_status_available_(true), started_(false) {}
26 virtual ~FakeBatteryManager() { } 26 virtual ~FakeBatteryManager() { }
27 27
28 // Methods from BatteryStatusManager. 28 // Methods from BatteryStatusManager.
29 virtual bool StartListeningBatteryChange() OVERRIDE { 29 virtual bool StartListeningBatteryChange() override {
30 started_ = true; 30 started_ = true;
31 if (battery_status_available_) 31 if (battery_status_available_)
32 InvokeUpdateCallback(); 32 InvokeUpdateCallback();
33 return battery_status_available_; 33 return battery_status_available_;
34 } 34 }
35 35
36 virtual void StopListeningBatteryChange() OVERRIDE { } 36 virtual void StopListeningBatteryChange() override { }
37 37
38 void InvokeUpdateCallback() { 38 void InvokeUpdateCallback() {
39 callback_.Run(status_); 39 callback_.Run(status_);
40 } 40 }
41 41
42 void set_battery_status(const blink::WebBatteryStatus& status) { 42 void set_battery_status(const blink::WebBatteryStatus& status) {
43 status_ = status; 43 status_ = status;
44 } 44 }
45 45
46 void set_battery_status_available(bool value) { 46 void set_battery_status_available(bool value) {
(...skipping 14 matching lines...) Expand all
61 }; 61 };
62 62
63 class BatteryStatusBrowserTest : public ContentBrowserTest { 63 class BatteryStatusBrowserTest : public ContentBrowserTest {
64 public: 64 public:
65 BatteryStatusBrowserTest() 65 BatteryStatusBrowserTest()
66 : battery_manager_(0), 66 : battery_manager_(0),
67 battery_service_(0), 67 battery_service_(0),
68 io_loop_finished_event_(false, false) { 68 io_loop_finished_event_(false, false) {
69 } 69 }
70 70
71 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 71 virtual void SetUpCommandLine(CommandLine* command_line) override {
72 command_line->AppendSwitch( 72 command_line->AppendSwitch(
73 switches::kEnableExperimentalWebPlatformFeatures); 73 switches::kEnableExperimentalWebPlatformFeatures);
74 } 74 }
75 75
76 virtual void SetUpOnMainThread() OVERRIDE { 76 virtual void SetUpOnMainThread() override {
77 BrowserThread::PostTask( 77 BrowserThread::PostTask(
78 BrowserThread::IO, FROM_HERE, 78 BrowserThread::IO, FROM_HERE,
79 base::Bind(&BatteryStatusBrowserTest::SetUpOnIOThread, this)); 79 base::Bind(&BatteryStatusBrowserTest::SetUpOnIOThread, this));
80 io_loop_finished_event_.Wait(); 80 io_loop_finished_event_.Wait();
81 } 81 }
82 82
83 void SetUpOnIOThread() { 83 void SetUpOnIOThread() {
84 battery_service_ = BatteryStatusService::GetInstance(); 84 battery_service_ = BatteryStatusService::GetInstance();
85 battery_manager_ = new FakeBatteryManager( 85 battery_manager_ = new FakeBatteryManager(
86 battery_service_->GetUpdateCallbackForTesting()); 86 battery_service_->GetUpdateCallbackForTesting());
87 battery_service_->SetBatteryManagerForTesting(battery_manager_); 87 battery_service_->SetBatteryManagerForTesting(battery_manager_);
88 io_loop_finished_event_.Signal(); 88 io_loop_finished_event_.Signal();
89 } 89 }
90 90
91 virtual void TearDown() OVERRIDE { 91 virtual void TearDown() override {
92 battery_service_->SetBatteryManagerForTesting(0); 92 battery_service_->SetBatteryManagerForTesting(0);
93 } 93 }
94 94
95 FakeBatteryManager* battery_manager() { 95 FakeBatteryManager* battery_manager() {
96 return battery_manager_; 96 return battery_manager_;
97 } 97 }
98 98
99 private: 99 private:
100 FakeBatteryManager* battery_manager_; 100 FakeBatteryManager* battery_manager_;
101 BatteryStatusService* battery_service_; 101 BatteryStatusService* battery_service_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 battery_manager()->set_battery_status(status); 156 battery_manager()->set_battery_status(status);
157 battery_manager()->InvokeUpdateCallback(); 157 battery_manager()->InvokeUpdateCallback();
158 same_tab_observer2.Wait(); 158 same_tab_observer2.Wait();
159 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); 159 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
160 EXPECT_TRUE(battery_manager()->started()); 160 EXPECT_TRUE(battery_manager()->started());
161 } 161 }
162 162
163 } // namespace 163 } // namespace
164 164
165 } // namespace content 165 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/battery_status/battery_status_manager_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698