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

Side by Side Diff: content/renderer/battery_status/battery_status_dispatcher_unittest.cc

Issue 833983002: Stop using [Client=...] feature of Mojom for BatteryMonitor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 5 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 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 "battery_status_dispatcher.h" 5 #include "battery_status_dispatcher.h"
6 6
7 #include "content/public/test/mock_render_thread.h" 7 #include "content/public/test/mock_render_thread.h"
8 #include "content/public/test/test_utils.h" 8 #include "content/public/test/test_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" 10 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 private: 52 private:
53 // We need to create a MockRenderThread so RenderThread::Get() doesn't return 53 // We need to create a MockRenderThread so RenderThread::Get() doesn't return
54 // null. 54 // null.
55 MockRenderThread render_thread_; 55 MockRenderThread render_thread_;
56 MockBatteryStatusListener listener_; 56 MockBatteryStatusListener listener_;
57 scoped_ptr<BatteryStatusDispatcher> dispatcher_; 57 scoped_ptr<BatteryStatusDispatcher> dispatcher_;
58 }; 58 };
59 59
60 TEST_F(BatteryStatusDispatcherTest, UpdateListener) { 60 TEST_F(BatteryStatusDispatcherTest, UpdateListener) {
61 // TODO(darin): This test isn't super interesting. It just exercises
62 // conversion b/w device::BatteryStatus and blink::WebBatteryStatus.
63
61 device::BatteryStatus status; 64 device::BatteryStatus status;
62 status.charging = true; 65 status.charging = true;
63 status.charging_time = 100; 66 status.charging_time = 100;
64 status.discharging_time = 200; 67 status.discharging_time = 200;
65 status.level = 0.5; 68 status.level = 0.5;
66 69
67 UpdateBatteryStatus(status); 70 UpdateBatteryStatus(status);
68 71
69 const blink::WebBatteryStatus& received_status = listener().status(); 72 const blink::WebBatteryStatus& received_status = listener().status();
70 EXPECT_TRUE(listener().did_change_battery_status()); 73 EXPECT_TRUE(listener().did_change_battery_status());
71 EXPECT_EQ(status.charging, received_status.charging); 74 EXPECT_EQ(status.charging, received_status.charging);
72 EXPECT_EQ(status.charging_time, received_status.chargingTime); 75 EXPECT_EQ(status.charging_time, received_status.chargingTime);
73 EXPECT_EQ(status.discharging_time, received_status.dischargingTime); 76 EXPECT_EQ(status.discharging_time, received_status.dischargingTime);
74 EXPECT_EQ(status.level, received_status.level); 77 EXPECT_EQ(status.level, received_status.level);
75 } 78 }
76 79
77 } // namespace content 80 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698