OLD | NEW |
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/test/in_process_browser_test.h" | 8 #include "chrome/test/in_process_browser_test.h" |
9 | 9 |
10 class ViewIDTest : public InProcessBrowserTest { | 10 class ViewIDTest : public InProcessBrowserTest { |
11 public: | 11 public: |
12 ViewIDTest() : root_window_(NULL) {} | 12 ViewIDTest() : root_window_(NULL) {} |
13 | 13 |
14 void CheckViewID(ViewID id, bool should_have) { | 14 void CheckViewID(ViewID id, bool should_have) { |
15 if (!root_window_) | 15 if (!root_window_) |
16 root_window_ = GTK_WIDGET(browser()->window()->GetNativeHandle()); | 16 root_window_ = GTK_WIDGET(browser()->window()->GetNativeHandle()); |
17 | 17 |
18 ASSERT_TRUE(root_window_); | 18 ASSERT_TRUE(root_window_); |
19 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id)); | 19 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id)); |
20 } | 20 } |
21 | 21 |
22 private: | 22 private: |
23 GtkWidget* root_window_; | 23 GtkWidget* root_window_; |
24 }; | 24 }; |
25 | 25 |
26 IN_PROC_BROWSER_TEST_F(ViewIDTest, Basic) { | 26 // Disabled since it is failing on buildbots. |
| 27 // http://code.google.com/p/chromium/issues/detail?id=21443 |
| 28 IN_PROC_BROWSER_TEST_F(ViewIDTest, DISABLED_Basic) { |
27 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { | 29 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { |
28 CheckViewID(static_cast<ViewID>(i), true); | 30 CheckViewID(static_cast<ViewID>(i), true); |
29 } | 31 } |
30 | 32 |
31 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false); | 33 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false); |
32 } | 34 } |
33 | 35 |
34 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) { | 36 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) { |
35 CheckViewID(VIEW_ID_TAB_0, true); | 37 CheckViewID(VIEW_ID_TAB_0, true); |
36 CheckViewID(VIEW_ID_TAB_1, false); | 38 CheckViewID(VIEW_ID_TAB_1, false); |
37 | 39 |
38 browser()->OpenURL(GURL("about:blank"), GURL(""), | 40 browser()->OpenURL(GURL("about:blank"), GURL(""), |
39 NEW_BACKGROUND_TAB, PageTransition::TYPED); | 41 NEW_BACKGROUND_TAB, PageTransition::TYPED); |
40 | 42 |
41 CheckViewID(VIEW_ID_TAB_0, true); | 43 CheckViewID(VIEW_ID_TAB_0, true); |
42 CheckViewID(VIEW_ID_TAB_1, true); | 44 CheckViewID(VIEW_ID_TAB_1, true); |
43 } | 45 } |
OLD | NEW |