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

Side by Side Diff: chrome/browser/gtk/view_id_util_browsertest.cc

Issue 387060: ViewIDTest.Basic fix (Closed)
Patch Set: Created 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser.h" 5 #include "chrome/browser/browser.h"
6 #include "chrome/browser/browser_window.h" 6 #include "chrome/browser/browser_window.h"
7 #include "chrome/browser/gtk/view_id_util.h" 7 #include "chrome/browser/gtk/view_id_util.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "chrome/test/in_process_browser_test.h" 9 #include "chrome/test/in_process_browser_test.h"
10 10
11 class ViewIDTest : public InProcessBrowserTest { 11 class ViewIDTest : public InProcessBrowserTest {
12 public: 12 public:
13 ViewIDTest() : root_window_(NULL) {} 13 ViewIDTest() : root_window_(NULL) {}
14 14
15 void CheckViewID(ViewID id, bool should_have) { 15 void CheckViewID(ViewID id, bool should_have) {
16 if (!root_window_) 16 if (!root_window_)
17 root_window_ = GTK_WIDGET(browser()->window()->GetNativeHandle()); 17 root_window_ = GTK_WIDGET(browser()->window()->GetNativeHandle());
18 18
19 ASSERT_TRUE(root_window_); 19 ASSERT_TRUE(root_window_);
20 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id)); 20 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id))
21 << " Failed id=" << id;
21 } 22 }
22 23
23 private: 24 private:
24 GtkWidget* root_window_; 25 GtkWidget* root_window_;
25 }; 26 };
26 27
27 IN_PROC_BROWSER_TEST_F(ViewIDTest, DISABLED_Basic) { 28 IN_PROC_BROWSER_TEST_F(ViewIDTest, Basic) {
29 // Make sure FindBar is created to test
30 // VIEW_ID_FIND_IN_PAGE_TEXT_FIELD and VIEW_ID_FIND_IN_PAGE.
31 browser()->ShowFindBar();
32
28 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { 33 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) {
29 // http://crbug.com/21152 34 // http://crbug.com/21152
30 if (i == VIEW_ID_BOOKMARK_MENU) 35 if (i == VIEW_ID_BOOKMARK_MENU)
31 continue; 36 continue;
32 37
33 // Extension shelf is being removed, http://crbug.com/25106. 38 // Extension shelf is being removed, http://crbug.com/25106.
34 if (i == VIEW_ID_DEV_EXTENSION_SHELF) 39 if (i == VIEW_ID_DEV_EXTENSION_SHELF)
35 continue; 40 continue;
36 41
37 CheckViewID(static_cast<ViewID>(i), true); 42 CheckViewID(static_cast<ViewID>(i), true);
38 } 43 }
39 44
40 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false); 45 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false);
41 } 46 }
42 47
43 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) { 48 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) {
44 CheckViewID(VIEW_ID_TAB_0, true); 49 CheckViewID(VIEW_ID_TAB_0, true);
45 CheckViewID(VIEW_ID_TAB_1, false); 50 CheckViewID(VIEW_ID_TAB_1, false);
46 51
47 browser()->OpenURL(GURL(chrome::kAboutBlankURL), GURL(), 52 browser()->OpenURL(GURL(chrome::kAboutBlankURL), GURL(),
48 NEW_BACKGROUND_TAB, PageTransition::TYPED); 53 NEW_BACKGROUND_TAB, PageTransition::TYPED);
49 54
50 CheckViewID(VIEW_ID_TAB_0, true); 55 CheckViewID(VIEW_ID_TAB_0, true);
51 CheckViewID(VIEW_ID_TAB_1, true); 56 CheckViewID(VIEW_ID_TAB_1, true);
52 } 57 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698