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

Side by Side Diff: chrome/browser/chromeos/status/power_menu_button_browsertest.cc

Issue 8438064: Separate StatusAreaView from StatusAreaViewChromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/status/power_menu_button.h" 5 #include "chrome/browser/chromeos/status/power_menu_button.h"
6 6
7 #include "chrome/browser/chromeos/frame/browser_view.h" 7 #include "chrome/browser/chromeos/frame/browser_view.h"
8 #include "chrome/browser/chromeos/status/status_area_view.h"
9 #include "chrome/browser/chromeos/view_ids.h" 8 #include "chrome/browser/chromeos/view_ids.h"
10 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
13 12
14 namespace chromeos { 13 namespace chromeos {
15 14
16 class PowerMenuButtonTest : public InProcessBrowserTest { 15 class PowerMenuButtonTest : public InProcessBrowserTest {
17 protected: 16 protected:
18 PowerMenuButtonTest() : InProcessBrowserTest() { 17 PowerMenuButtonTest() : InProcessBrowserTest() {
19 } 18 }
20 19
21 virtual void SetUpInProcessBrowserTestFixture() { 20 virtual void SetUpInProcessBrowserTestFixture() {
22 } 21 }
23 22
24 PowerMenuButton* GetPowerMenuButton() { 23 PowerMenuButton* GetPowerMenuButton() {
25 BrowserView* view = static_cast<BrowserView*>(browser()->window()); 24 BrowserView* view = static_cast<BrowserView*>(browser()->window());
26 PowerMenuButton* power = static_cast<StatusAreaView*>(view-> 25 return static_cast<PowerMenuButton*>(view->GetViewByID(
27 GetViewByID(VIEW_ID_STATUS_AREA))->power_view(); 26 VIEW_ID_STATUS_BUTTON_POWER));
28 return power;
29 } 27 }
30 28
31 string16 CallPowerChangedAndGetTooltipText(const PowerSupplyStatus& status) { 29 string16 CallPowerChangedAndGetTooltipText(const PowerSupplyStatus& status) {
32 PowerMenuButton* power = GetPowerMenuButton(); 30 PowerMenuButton* power = GetPowerMenuButton();
33 power->PowerChanged(status); 31 power->PowerChanged(status);
34 string16 tooltip; 32 string16 tooltip;
35 // There is static_cast<StatusAreaButton*> because GetTootipText is also 33 // There is static_cast<StatusAreaButton*> because GetTootipText is also
36 // declared in MenuDelegate 34 // declared in MenuDelegate
37 EXPECT_TRUE(static_cast<StatusAreaButton*>(power)->GetTooltipText( 35 EXPECT_TRUE(static_cast<StatusAreaButton*>(power)->GetTooltipText(
38 gfx::Point(0, 0), &tooltip)); 36 gfx::Point(0, 0), &tooltip));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Simulate various levels of discharging. 112 // Simulate various levels of discharging.
115 for (double percent = 5.0; percent < 100.0; percent += 5.0) { 113 for (double percent = 5.0; percent < 100.0; percent += 5.0) {
116 status.battery_percentage = percent; 114 status.battery_percentage = percent;
117 const string16 tooltip_after = CallPowerChangedAndGetTooltipText(status); 115 const string16 tooltip_after = CallPowerChangedAndGetTooltipText(status);
118 EXPECT_NE(tooltip_before, tooltip_after); 116 EXPECT_NE(tooltip_before, tooltip_after);
119 tooltip_before = tooltip_after; 117 tooltip_before = tooltip_after;
120 } 118 }
121 } 119 }
122 120
123 } // namespace chromeos 121 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/power_menu_button.cc ('k') | chrome/browser/chromeos/status/status_area_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698