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

Side by Side Diff: chrome/browser/ui/views/html_dialog_view_browsertest.cc

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "chrome/browser/browser_thread.h" 10 #include "chrome/browser/browser_thread.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 class HtmlDialogBrowserTest : public InProcessBrowserTest { 67 class HtmlDialogBrowserTest : public InProcessBrowserTest {
68 public: 68 public:
69 HtmlDialogBrowserTest() {} 69 HtmlDialogBrowserTest() {}
70 70
71 #if defined(OS_WIN) 71 #if defined(OS_WIN)
72 class WindowChangedObserver : public base::MessagePumpForUI::Observer { 72 class WindowChangedObserver : public base::MessagePumpForUI::Observer {
73 public: 73 public:
74 WindowChangedObserver() {} 74 WindowChangedObserver() {}
75 75
76 static WindowChangedObserver* Get() { 76 static WindowChangedObserver* GetInstance() {
77 return Singleton<WindowChangedObserver>::get(); 77 return Singleton<WindowChangedObserver>::get();
78 } 78 }
79 79
80 // This method is called before processing a message. 80 // This method is called before processing a message.
81 virtual void WillProcessMessage(const MSG& msg) {} 81 virtual void WillProcessMessage(const MSG& msg) {}
82 82
83 // This method is called after processing a message. 83 // This method is called after processing a message.
84 virtual void DidProcessMessage(const MSG& msg) { 84 virtual void DidProcessMessage(const MSG& msg) {
85 // Either WM_PAINT or WM_TIMER indicates the actual work of 85 // Either WM_PAINT or WM_TIMER indicates the actual work of
86 // pushing through the window resizing messages is done since 86 // pushing through the window resizing messages is done since
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 HtmlDialogView* html_view = 130 HtmlDialogView* html_view =
131 new HtmlDialogView(browser()->profile(), delegate); 131 new HtmlDialogView(browser()->profile(), delegate);
132 TabContents* tab_contents = browser()->GetSelectedTabContents(); 132 TabContents* tab_contents = browser()->GetSelectedTabContents();
133 ASSERT_TRUE(tab_contents != NULL); 133 ASSERT_TRUE(tab_contents != NULL);
134 views::Window::CreateChromeWindow(tab_contents->GetMessageBoxRootWindow(), 134 views::Window::CreateChromeWindow(tab_contents->GetMessageBoxRootWindow(),
135 gfx::Rect(), html_view); 135 gfx::Rect(), html_view);
136 html_view->InitDialog(); 136 html_view->InitDialog();
137 html_view->window()->Show(); 137 html_view->window()->Show();
138 138
139 MessageLoopForUI::current()->AddObserver(WindowChangedObserver::Get()); 139 MessageLoopForUI::current()->AddObserver(
140 WindowChangedObserver::GetInstance());
140 141
141 gfx::Rect bounds; 142 gfx::Rect bounds;
142 html_view->GetWidget()->GetBounds(&bounds, false); 143 html_view->GetWidget()->GetBounds(&bounds, false);
143 144
144 gfx::Rect set_bounds = bounds; 145 gfx::Rect set_bounds = bounds;
145 gfx::Rect actual_bounds, rwhv_bounds; 146 gfx::Rect actual_bounds, rwhv_bounds;
146 147
147 // Bigger than the default in both dimensions. 148 // Bigger than the default in both dimensions.
148 set_bounds.set_width(400); 149 set_bounds.set_width(400);
149 set_bounds.set_height(300); 150 set_bounds.set_height(300);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Check to make sure we can't get to 0x0 196 // Check to make sure we can't get to 0x0
196 set_bounds.set_width(0); 197 set_bounds.set_width(0);
197 set_bounds.set_height(0); 198 set_bounds.set_height(0);
198 199
199 html_view->MoveContents(tab_contents, set_bounds); 200 html_view->MoveContents(tab_contents, set_bounds);
200 ui_test_utils::RunMessageLoop(); 201 ui_test_utils::RunMessageLoop();
201 html_view->GetWidget()->GetBounds(&actual_bounds, false); 202 html_view->GetWidget()->GetBounds(&actual_bounds, false);
202 EXPECT_LT(0, actual_bounds.width()); 203 EXPECT_LT(0, actual_bounds.width());
203 EXPECT_LT(0, actual_bounds.height()); 204 EXPECT_LT(0, actual_bounds.height());
204 205
205 MessageLoopForUI::current()->RemoveObserver(WindowChangedObserver::Get()); 206 MessageLoopForUI::current()->RemoveObserver(
207 WindowChangedObserver::GetInstance());
206 } 208 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/page_info_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698