OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
12 #include "chrome/browser/extensions/browser_action_test_util.h" | 12 #include "chrome/browser/extensions/browser_action_test_util.h" |
13 #include "chrome/browser/extensions/extension_apitest.h" | 13 #include "chrome/browser/extensions/extension_apitest.h" |
14 #include "chrome/browser/extensions/extension_browser_event_router.h" | 14 #include "chrome/browser/extensions/extension_browser_event_router.h" |
15 #include "chrome/browser/extensions/extension_tabs_module.h" | 15 #include "chrome/browser/extensions/extension_tabs_module.h" |
16 #include "chrome/browser/extensions/extensions_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/tab_contents/tab_contents.h" | 18 #include "chrome/browser/tab_contents/tab_contents.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/extensions/extension_action.h" | 21 #include "chrome/common/extensions/extension_action.h" |
22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "chrome/test/ui_test_utils.h" | 23 #include "chrome/test/ui_test_utils.h" |
24 #include "gfx/rect.h" | 24 #include "gfx/rect.h" |
25 #include "gfx/size.h" | 25 #include "gfx/size.h" |
26 | 26 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // default. | 279 // default. |
280 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 280 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
281 Browser* incognito_browser = Browser::Create(incognito_profile); | 281 Browser* incognito_browser = Browser::Create(incognito_profile); |
282 | 282 |
283 ASSERT_EQ(0, | 283 ASSERT_EQ(0, |
284 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); | 284 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); |
285 | 285 |
286 // Now enable the extension in incognito mode, and test that the browser | 286 // Now enable the extension in incognito mode, and test that the browser |
287 // action shows up. Note that we don't update the existing window at the | 287 // action shows up. Note that we don't update the existing window at the |
288 // moment, so we just create a new one. | 288 // moment, so we just create a new one. |
289 browser()->profile()->GetExtensionsService()->extension_prefs()-> | 289 browser()->profile()->GetExtensionService()->extension_prefs()-> |
290 SetIsIncognitoEnabled(extension->id(), true); | 290 SetIsIncognitoEnabled(extension->id(), true); |
291 | 291 |
292 incognito_browser->CloseWindow(); | 292 incognito_browser->CloseWindow(); |
293 incognito_browser = Browser::Create(incognito_profile); | 293 incognito_browser = Browser::Create(incognito_profile); |
294 ASSERT_EQ(1, | 294 ASSERT_EQ(1, |
295 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); | 295 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); |
296 | 296 |
297 // TODO(mpcomplete): simulate a click and have it do the right thing in | 297 // TODO(mpcomplete): simulate a click and have it do the right thing in |
298 // incognito. | 298 // incognito. |
299 } | 299 } |
300 | 300 |
301 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) { | 301 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) { |
302 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 302 ExtensionService* service = browser()->profile()->GetExtensionService(); |
303 | 303 |
304 // The tooltips for each respective browser action. | 304 // The tooltips for each respective browser action. |
305 const char kTooltipA[] = "Make this page red"; | 305 const char kTooltipA[] = "Make this page red"; |
306 const char kTooltipB[] = "grow"; | 306 const char kTooltipB[] = "grow"; |
307 const char kTooltipC[] = "Test setPopup()"; | 307 const char kTooltipC[] = "Test setPopup()"; |
308 | 308 |
309 const size_t size_before = service->extensions()->size(); | 309 const size_t size_before = service->extensions()->size(); |
310 | 310 |
311 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII( | 311 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII( |
312 "browser_action/basics"))); | 312 "browser_action/basics"))); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 service->toolbar_model()->MoveBrowserAction( | 362 service->toolbar_model()->MoveBrowserAction( |
363 service->extensions()->at(size_before + 1), 1); | 363 service->extensions()->at(size_before + 1), 1); |
364 | 364 |
365 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); | 365 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); |
366 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); | 366 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); |
367 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); | 367 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); |
368 | 368 |
369 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); | 369 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); |
370 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); | 370 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); |
371 } | 371 } |
OLD | NEW |