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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 395783002: [DevTools] Move DevToolsWindow testing code to a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: includes Created 6 years, 5 months 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 // 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
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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 DevToolsWindow::GetInstanceForInspectedWebContents(contents); 1366 DevToolsWindow::GetInstanceForInspectedWebContents(contents);
1367 EXPECT_TRUE(devtools_window); 1367 EXPECT_TRUE(devtools_window);
1368 1368
1369 // Disable devtools via policy. 1369 // Disable devtools via policy.
1370 PolicyMap policies; 1370 PolicyMap policies;
1371 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY, 1371 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY,
1372 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); 1372 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL);
1373 content::WindowedNotificationObserver close_observer( 1373 content::WindowedNotificationObserver close_observer(
1374 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 1374 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
1375 content::Source<content::WebContents>( 1375 content::Source<content::WebContents>(
1376 devtools_window->web_contents_for_test())); 1376 DevToolsWindowTesting::Get(devtools_window)->main_web_contents()));
1377 UpdateProviderPolicy(policies); 1377 UpdateProviderPolicy(policies);
1378 // wait for devtools close 1378 // wait for devtools close
1379 close_observer.Wait(); 1379 close_observer.Wait();
1380 // The existing devtools window should have closed. 1380 // The existing devtools window should have closed.
1381 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents)); 1381 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents));
1382 // And it's not possible to open it again. 1382 // And it's not possible to open it again.
1383 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); 1383 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS));
1384 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents)); 1384 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedWebContents(contents));
1385 } 1385 }
1386 1386
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
3037 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 3037 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
3038 browser2->tab_strip_model()->GetActiveWebContents(), 3038 browser2->tab_strip_model()->GetActiveWebContents(),
3039 "domAutomationController.send(window.showModalDialog !== undefined);", 3039 "domAutomationController.send(window.showModalDialog !== undefined);",
3040 &result)); 3040 &result));
3041 EXPECT_TRUE(result); 3041 EXPECT_TRUE(result);
3042 } 3042 }
3043 3043
3044 #endif // !defined(CHROME_OS) 3044 #endif // !defined(CHROME_OS)
3045 3045
3046 } // namespace policy 3046 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698