| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
| 9 #include "chrome/browser/ui/gtk/view_id_util.h" | 9 #include "chrome/browser/ui/gtk/view_id_util.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 12 | 12 |
| 13 using content::OpenURLParams; | 13 using content::OpenURLParams; |
| 14 | 14 |
| 15 class ViewIDTest : public InProcessBrowserTest { | 15 class ViewIDTest : public InProcessBrowserTest { |
| 16 public: | 16 public: |
| 17 ViewIDTest() : root_window_(NULL) {} | 17 ViewIDTest() : root_window_(NULL) {} |
| 18 | 18 |
| 19 void CheckViewID(ViewID id, bool should_have) { | 19 void CheckViewID(ViewID id, bool should_have) { |
| 20 if (!root_window_) | 20 if (!root_window_) |
| 21 root_window_ = GTK_WIDGET(browser()->window()->GetNativeHandle()); | 21 root_window_ = GTK_WIDGET(browser()->window()->GetNativeWindow()); |
| 22 | 22 |
| 23 ASSERT_TRUE(root_window_); | 23 ASSERT_TRUE(root_window_); |
| 24 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id)) | 24 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id)) |
| 25 << " Failed id=" << id; | 25 << " Failed id=" << id; |
| 26 } | 26 } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 GtkWidget* root_window_; | 29 GtkWidget* root_window_; |
| 30 }; | 30 }; |
| 31 | 31 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 CheckViewID(VIEW_ID_TAB_1, false); | 58 CheckViewID(VIEW_ID_TAB_1, false); |
| 59 | 59 |
| 60 browser()->OpenURL(OpenURLParams(GURL(chrome::kAboutBlankURL), | 60 browser()->OpenURL(OpenURLParams(GURL(chrome::kAboutBlankURL), |
| 61 content::Referrer(), | 61 content::Referrer(), |
| 62 NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_TYPED, | 62 NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_TYPED, |
| 63 false)); | 63 false)); |
| 64 | 64 |
| 65 CheckViewID(VIEW_ID_TAB_0, true); | 65 CheckViewID(VIEW_ID_TAB_0, true); |
| 66 CheckViewID(VIEW_ID_TAB_1, true); | 66 CheckViewID(VIEW_ID_TAB_1, true); |
| 67 } | 67 } |
| OLD | NEW |