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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
25 #include "base/test/test_file_util.h" | 25 #include "base/test/test_file_util.h" |
26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
27 #include "base/values.h" | 27 #include "base/values.h" |
28 #include "chrome/app/chrome_command_ids.h" | 28 #include "chrome/app/chrome_command_ids.h" |
29 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 29 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
30 #include "chrome/browser/background/background_contents_service.h" | 30 #include "chrome/browser/background/background_contents_service.h" |
31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
32 #include "chrome/browser/chrome_notification_types.h" | 32 #include "chrome/browser/chrome_notification_types.h" |
33 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 33 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
34 #include "chrome/browser/devtools/devtools_window.h" | 34 #include "chrome/browser/devtools/devtools_window_testing.h" |
35 #include "chrome/browser/download/download_prefs.h" | 35 #include "chrome/browser/download/download_prefs.h" |
36 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" | 36 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" |
37 #include "chrome/browser/extensions/crx_installer.h" | 37 #include "chrome/browser/extensions/crx_installer.h" |
38 #include "chrome/browser/extensions/extension_service.h" | 38 #include "chrome/browser/extensions/extension_service.h" |
39 #include "chrome/browser/extensions/unpacked_installer.h" | 39 #include "chrome/browser/extensions/unpacked_installer.h" |
40 #include "chrome/browser/extensions/updater/extension_cache_fake.h" | 40 #include "chrome/browser/extensions/updater/extension_cache_fake.h" |
41 #include "chrome/browser/extensions/updater/extension_updater.h" | 41 #include "chrome/browser/extensions/updater/extension_updater.h" |
42 #include "chrome/browser/infobars/infobar_service.h" | 42 #include "chrome/browser/infobars/infobar_service.h" |
43 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 43 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
44 #include "chrome/browser/media/media_stream_devices_controller.h" | 44 #include "chrome/browser/media/media_stream_devices_controller.h" |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 // Disable devtools via policy. | 1421 // Disable devtools via policy. |
1422 PolicyMap policies; | 1422 PolicyMap policies; |
1423 policies.Set(key::kDeveloperToolsDisabled, | 1423 policies.Set(key::kDeveloperToolsDisabled, |
1424 POLICY_LEVEL_MANDATORY, | 1424 POLICY_LEVEL_MANDATORY, |
1425 POLICY_SCOPE_USER, | 1425 POLICY_SCOPE_USER, |
1426 new base::FundamentalValue(true), | 1426 new base::FundamentalValue(true), |
1427 NULL); | 1427 NULL); |
1428 content::WindowedNotificationObserver close_observer( | 1428 content::WindowedNotificationObserver close_observer( |
1429 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 1429 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
1430 content::Source<content::WebContents>( | 1430 content::Source<content::WebContents>( |
1431 devtools_window->web_contents_for_test())); | 1431 DevToolsWindowTesting::Get(devtools_window)->main_web_contents())); |
1432 UpdateProviderPolicy(policies); | 1432 UpdateProviderPolicy(policies); |
1433 // wait for devtools close | 1433 // wait for devtools close |
1434 close_observer.Wait(); | 1434 close_observer.Wait(); |
1435 // The existing devtools window should have closed. | 1435 // The existing devtools window should have closed. |
1436 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents)); | 1436 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents)); |
1437 // And it's not possible to open it again. | 1437 // And it's not possible to open it again. |
1438 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); | 1438 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); |
1439 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents)); | 1439 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents)); |
1440 } | 1440 } |
1441 | 1441 |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3154 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3154 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
3155 browser2->tab_strip_model()->GetActiveWebContents(), | 3155 browser2->tab_strip_model()->GetActiveWebContents(), |
3156 "domAutomationController.send(window.showModalDialog !== undefined);", | 3156 "domAutomationController.send(window.showModalDialog !== undefined);", |
3157 &result)); | 3157 &result)); |
3158 EXPECT_TRUE(result); | 3158 EXPECT_TRUE(result); |
3159 } | 3159 } |
3160 | 3160 |
3161 #endif // !defined(CHROME_OS) | 3161 #endif // !defined(CHROME_OS) |
3162 | 3162 |
3163 } // namespace policy | 3163 } // namespace policy |
OLD | NEW |