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 <map> | 5 #include <map> |
6 | 6 |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
11 #include "chrome/browser/extensions/test_management_policy.h" | 11 #include "chrome/browser/extensions/test_management_policy.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_iterator.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/manifest.h" | 20 #include "chrome/common/extensions/manifest.h" |
21 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
22 | 22 |
23 using extensions::Extension; | 23 using extensions::Extension; |
24 using extensions::Manifest; | 24 using extensions::Manifest; |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Find a browser other than |browser|. | 28 // Find a browser other than |browser|. |
29 Browser* FindOtherBrowser(Browser* browser) { | 29 Browser* FindOtherBrowser(Browser* browser) { |
30 Browser* found = NULL; | 30 Browser* found = NULL; |
31 for (BrowserList::const_iterator it = BrowserList::begin(); | 31 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
32 it != BrowserList::end(); ++it) { | |
33 if (*it == browser) | 32 if (*it == browser) |
34 continue; | 33 continue; |
35 found = *it; | 34 found = *it; |
36 } | 35 } |
37 | |
38 return found; | 36 return found; |
39 } | 37 } |
40 | 38 |
41 } // namespace | 39 } // namespace |
42 | 40 |
43 class ExtensionManagementApiTest : public ExtensionApiTest { | 41 class ExtensionManagementApiTest : public ExtensionApiTest { |
44 public: | 42 public: |
45 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 43 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
46 ExtensionApiTest::SetUpCommandLine(command_line); | 44 ExtensionApiTest::SetUpCommandLine(command_line); |
47 command_line->AppendSwitch(switches::kEnablePanels); | 45 command_line->AppendSwitch(switches::kEnablePanels); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 262 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
265 #else | 263 #else |
266 // Find the app's browser. Opening in a new window will create | 264 // Find the app's browser. Opening in a new window will create |
267 // a new browser. | 265 // a new browser. |
268 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); | 266 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); |
269 Browser* app_browser = FindOtherBrowser(browser()); | 267 Browser* app_browser = FindOtherBrowser(browser()); |
270 ASSERT_TRUE(app_browser->is_app()); | 268 ASSERT_TRUE(app_browser->is_app()); |
271 ASSERT_FALSE(app_browser->is_type_panel()); | 269 ASSERT_FALSE(app_browser->is_type_panel()); |
272 #endif | 270 #endif |
273 } | 271 } |
OLD | NEW |