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

Side by Side Diff: chrome/browser/ui/panels/panel_app_browsertest.cc

Issue 8414020: Expose the sandbox related code through the content API. I did a bit of cleanup while I was doing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
1 1
2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/mac/scoped_nsautorelease_pool.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_init.h" 12 #include "chrome/browser/ui/browser_init.h"
14 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/panels/panel_manager.h" 15 #include "chrome/browser/ui/panels/panel_manager.h"
17 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
20 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
21 20
21 #if defined(OS_MACOSX)
22 #include "base/mac/scoped_nsautorelease_pool.h"
23 #endif
24
22 class PanelAppBrowserTest : public ExtensionBrowserTest { 25 class PanelAppBrowserTest : public ExtensionBrowserTest {
23 public: 26 public:
24 virtual void SetUpCommandLine(CommandLine* command_line) { 27 virtual void SetUpCommandLine(CommandLine* command_line) {
25 ExtensionBrowserTest::SetUpCommandLine(command_line); 28 ExtensionBrowserTest::SetUpCommandLine(command_line);
26 } 29 }
27 30
28 void LoadAndLaunchExtension(const char* name) { 31 void LoadAndLaunchExtension(const char* name) {
32 #if defined(OS_MACOSX)
29 // Opening panels on a Mac causes NSWindowController of the Panel window 33 // Opening panels on a Mac causes NSWindowController of the Panel window
30 // to be autoreleased. We need a pool drained after it's done so the test 34 // to be autoreleased. We need a pool drained after it's done so the test
31 // can close correctly. The NSWindowController of the Panel window controls 35 // can close correctly. The NSWindowController of the Panel window controls
32 // lifetime of the Browser object so we want to release it as soon as 36 // lifetime of the Browser object so we want to release it as soon as
33 // possible. In real Chrome, this is done by message pump. 37 // possible. In real Chrome, this is done by message pump.
34 // On non-Mac platform, this is an empty class. 38 // On non-Mac platform, this is an empty class.
35 base::mac::ScopedNSAutoreleasePool autorelease_pool; 39 base::mac::ScopedNSAutoreleasePool autorelease_pool;
40 #endif
36 41
37 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); 42 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name)));
38 43
39 ExtensionService* service = browser()->profile()->GetExtensionService(); 44 ExtensionService* service = browser()->profile()->GetExtensionService();
40 const Extension* extension = service->GetExtensionById( 45 const Extension* extension = service->GetExtensionById(
41 last_loaded_extension_id_, false); 46 last_loaded_extension_id_, false);
42 EXPECT_TRUE(extension); 47 EXPECT_TRUE(extension);
43 48
44 size_t browser_count = BrowserList::size(); 49 size_t browser_count = BrowserList::size();
45 50
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 EXPECT_TRUE(new_browser->is_type_panel()); 98 EXPECT_TRUE(new_browser->is_type_panel());
94 99
95 // Now also check that PanelManager has one new Panel under management. 100 // Now also check that PanelManager has one new Panel under management.
96 EXPECT_EQ(1, panel_manager->num_panels()); 101 EXPECT_EQ(1, panel_manager->num_panels());
97 102
98 CloseWindowAndWait(new_browser); 103 CloseWindowAndWait(new_browser);
99 104
100 EXPECT_EQ(0, panel_manager->num_panels()); 105 EXPECT_EQ(0, panel_manager->num_panels());
101 EXPECT_EQ(1u, BrowserList::size()); 106 EXPECT_EQ(1u, BrowserList::size());
102 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698