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

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

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <gtk/gtk.h>
6
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/gtk/view_id_util.h"
11 #include "chrome/common/url_constants.h"
12 #include "chrome/test/base/in_process_browser_test.h"
13
14 using content::OpenURLParams;
15
16 class ViewIDTest : public InProcessBrowserTest {
17 public:
18 ViewIDTest() : root_window_(NULL) {}
19
20 void CheckViewID(ViewID id, bool should_have) {
21 if (!root_window_)
22 root_window_ = GTK_WIDGET(browser()->window()->GetNativeWindow());
23
24 ASSERT_TRUE(root_window_);
25 EXPECT_EQ(should_have, !!ViewIDUtil::GetWidget(root_window_, id))
26 << " Failed id=" << id;
27 }
28
29 private:
30 GtkWidget* root_window_;
31 };
32
33 IN_PROC_BROWSER_TEST_F(ViewIDTest, Basic) {
34 // Make sure FindBar is created to test
35 // VIEW_ID_FIND_IN_PAGE_TEXT_FIELD and VIEW_ID_FIND_IN_PAGE.
36 chrome::ShowFindBar(browser());
37
38 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) {
39 // The following ids are used only in views implementation.
40 if (i == VIEW_ID_CONTENTS_SPLIT ||
41 i == VIEW_ID_INFO_BAR_CONTAINER ||
42 i == VIEW_ID_DEV_TOOLS_DOCKED ||
43 i == VIEW_ID_DOWNLOAD_SHELF ||
44 i == VIEW_ID_BOOKMARK_BAR_ELEMENT ||
45 i == VIEW_ID_TAB ||
46 i == VIEW_ID_FEEDBACK_BUTTON ||
47 i == VIEW_ID_SCRIPT_BUBBLE ||
48 i == VIEW_ID_MIC_SEARCH_BUTTON ||
49 i == VIEW_ID_TRANSLATE_BUTTON) {
50 continue;
51 }
52
53 CheckViewID(static_cast<ViewID>(i), true);
54 }
55
56 CheckViewID(VIEW_ID_PREDEFINED_COUNT, false);
57 }
58
59 IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) {
60 CheckViewID(VIEW_ID_TAB_0, true);
61 CheckViewID(VIEW_ID_TAB_1, false);
62
63 browser()->OpenURL(OpenURLParams(GURL(content::kAboutBlankURL),
64 content::Referrer(),
65 NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_TYPED,
66 false));
67
68 CheckViewID(VIEW_ID_TAB_0, true);
69 CheckViewID(VIEW_ID_TAB_1, true);
70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698