| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 12 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 13 #include "chrome/browser/ui/gtk/gtk_util.h" | 12 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 13 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "ui/base/gtk/gtk_hig_constants.h" | 15 #include "ui/base/gtk/gtk_hig_constants.h" |
| 16 | 16 |
| 17 class BubbleGtkTest : public InProcessBrowserTest, | 17 class BubbleGtkTest : public InProcessBrowserTest, |
| 18 public BubbleDelegateGtk { | 18 public BubbleDelegateGtk { |
| 19 public: | 19 public: |
| 20 BubbleGtkTest() : browser_window_(NULL) { | 20 BubbleGtkTest() : browser_window_(NULL) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 virtual ~BubbleGtkTest() { | 23 virtual ~BubbleGtkTest() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 {width - 1, height - 1, BubbleGtk::ARROW_LOCATION_BOTTOM_RIGHT}, | 65 {width - 1, height - 1, BubbleGtk::ARROW_LOCATION_BOTTOM_RIGHT}, |
| 66 }; | 66 }; |
| 67 static const BubbleGtk::ArrowLocationGtk kPreferredLocations[] = { | 67 static const BubbleGtk::ArrowLocationGtk kPreferredLocations[] = { |
| 68 BubbleGtk::ARROW_LOCATION_TOP_LEFT, | 68 BubbleGtk::ARROW_LOCATION_TOP_LEFT, |
| 69 BubbleGtk::ARROW_LOCATION_TOP_RIGHT, | 69 BubbleGtk::ARROW_LOCATION_TOP_RIGHT, |
| 70 BubbleGtk::ARROW_LOCATION_BOTTOM_LEFT, | 70 BubbleGtk::ARROW_LOCATION_BOTTOM_LEFT, |
| 71 BubbleGtk::ARROW_LOCATION_BOTTOM_RIGHT, | 71 BubbleGtk::ARROW_LOCATION_BOTTOM_RIGHT, |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 GtkWidget* anchor = GetNativeBrowserWindow(); | 74 GtkWidget* anchor = GetNativeBrowserWindow(); |
| 75 GtkThemeService* theme_service = GtkThemeService::GetFrom(GetProfile()); | 75 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom(GetProfile()); |
| 76 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(points); ++i) { | 76 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(points); ++i) { |
| 77 for (size_t j = 0; j < arraysize(kPreferredLocations); ++j) { | 77 for (size_t j = 0; j < arraysize(kPreferredLocations); ++j) { |
| 78 static const char kText[] = | 78 static const char kText[] = |
| 79 "Google's mission is to organize the world's information and make it" | 79 "Google's mission is to organize the world's information and make it" |
| 80 " universally accessible and useful."; | 80 " universally accessible and useful."; |
| 81 GtkWidget* label = theme_service->BuildLabel(kText, ui::kGdkBlack); | 81 GtkWidget* label = theme_service->BuildLabel(kText, ui::kGdkBlack); |
| 82 gfx::Rect rect(points[i].x, points[i].y, 0, 0); | 82 gfx::Rect rect(points[i].x, points[i].y, 0, 0); |
| 83 BubbleGtk* bubble = BubbleGtk::Show(anchor, | 83 BubbleGtk* bubble = BubbleGtk::Show(anchor, |
| 84 &rect, | 84 &rect, |
| 85 label, | 85 label, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 105 {width - 1, 0, BubbleGtk::ARROW_LOCATION_NONE}, | 105 {width - 1, 0, BubbleGtk::ARROW_LOCATION_NONE}, |
| 106 {0, height - 1, BubbleGtk::ARROW_LOCATION_FLOAT}, | 106 {0, height - 1, BubbleGtk::ARROW_LOCATION_FLOAT}, |
| 107 {width - 1, height - 1, BubbleGtk::ARROW_LOCATION_FLOAT}, | 107 {width - 1, height - 1, BubbleGtk::ARROW_LOCATION_FLOAT}, |
| 108 }; | 108 }; |
| 109 static const BubbleGtk::ArrowLocationGtk kPreferredLocations[] = { | 109 static const BubbleGtk::ArrowLocationGtk kPreferredLocations[] = { |
| 110 BubbleGtk::ARROW_LOCATION_NONE, | 110 BubbleGtk::ARROW_LOCATION_NONE, |
| 111 BubbleGtk::ARROW_LOCATION_FLOAT, | 111 BubbleGtk::ARROW_LOCATION_FLOAT, |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 GtkWidget* anchor = GetNativeBrowserWindow(); | 114 GtkWidget* anchor = GetNativeBrowserWindow(); |
| 115 GtkThemeService* theme_service = GtkThemeService::GetFrom(GetProfile()); | 115 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom(GetProfile()); |
| 116 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(points); ++i) { | 116 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(points); ++i) { |
| 117 for (size_t j = 0; j < arraysize(kPreferredLocations); ++j) { | 117 for (size_t j = 0; j < arraysize(kPreferredLocations); ++j) { |
| 118 static const char kText[] = | 118 static const char kText[] = |
| 119 "Google's mission is to organize the world's information and make it" | 119 "Google's mission is to organize the world's information and make it" |
| 120 " universally accessible and useful."; | 120 " universally accessible and useful."; |
| 121 GtkWidget* label = theme_service->BuildLabel(kText, ui::kGdkBlack); | 121 GtkWidget* label = theme_service->BuildLabel(kText, ui::kGdkBlack); |
| 122 gfx::Rect rect(points[i].x, points[i].y, 0, 0); | 122 gfx::Rect rect(points[i].x, points[i].y, 0, 0); |
| 123 BubbleGtk* bubble = BubbleGtk::Show(anchor, | 123 BubbleGtk* bubble = BubbleGtk::Show(anchor, |
| 124 &rect, | 124 &rect, |
| 125 label, | 125 label, |
| 126 kPreferredLocations[j], | 126 kPreferredLocations[j], |
| 127 true, | 127 true, |
| 128 true, | 128 true, |
| 129 theme_service, | 129 theme_service, |
| 130 this); | 130 this); |
| 131 EXPECT_EQ(points[i].expected, bubble->current_arrow_location_); | 131 EXPECT_EQ(points[i].expected, bubble->current_arrow_location_); |
| 132 bubble->Close(); | 132 bubble->Close(); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 } | 135 } |
| OLD | NEW |