| 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 // Disabled since it is failing on buildbots. | 26 IN_PROC_BROWSER_TEST_F(ViewIDTest, Basic) { |
| 27 // http://code.google.com/p/chromium/issues/detail?id=21443 | |
| 28 IN_PROC_BROWSER_TEST_F(ViewIDTest, DISABLED_Basic) { | |
| 29 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { | 27 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { |
| 30 CheckViewID(static_cast<ViewID>(i), true); | 28 CheckViewID(static_cast<ViewID>(i), true); |
| 31 } | 29 } |
| 32 | 30 |
| 33 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false); | 31 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false); |
| 34 } | 32 } |
| 35 | 33 |
| 36 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) { | 34 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) { |
| 37 CheckViewID(VIEW_ID_TAB_0, true); | 35 CheckViewID(VIEW_ID_TAB_0, true); |
| 38 CheckViewID(VIEW_ID_TAB_1, false); | 36 CheckViewID(VIEW_ID_TAB_1, false); |
| 39 | 37 |
| 40 browser()->OpenURL(GURL("about:blank"), GURL(""), | 38 browser()->OpenURL(GURL("about:blank"), GURL(""), |
| 41 NEW_BACKGROUND_TAB, PageTransition::TYPED); | 39 NEW_BACKGROUND_TAB, PageTransition::TYPED); |
| 42 | 40 |
| 43 CheckViewID(VIEW_ID_TAB_0, true); | 41 CheckViewID(VIEW_ID_TAB_0, true); |
| 44 CheckViewID(VIEW_ID_TAB_1, true); | 42 CheckViewID(VIEW_ID_TAB_1, true); |
| 45 } | 43 } |
| OLD | NEW |