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

Side by Side Diff: chrome/browser/extensions/extension_messages_apitest.cc

Issue 1129033008: Don't crash on chrome.runtime.connect(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests Created 5 years, 7 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 EXPECT_NE(incognito_frame1, incognito_frame2); 872 EXPECT_NE(incognito_frame1, incognito_frame2);
873 873
874 EXPECT_EQ(1U, infobar_service1->infobar_count()); 874 EXPECT_EQ(1U, infobar_service1->infobar_count());
875 EXPECT_EQ(OK, CanConnectAndSendMessagesToFrame(incognito_frame2, app.get(), 875 EXPECT_EQ(OK, CanConnectAndSendMessagesToFrame(incognito_frame2, app.get(),
876 NULL)); 876 NULL));
877 EXPECT_EQ(1, alert_tracker.GetAndResetAlertCount()); 877 EXPECT_EQ(1, alert_tracker.GetAndResetAlertCount());
878 EXPECT_EQ(0U, infobar_service1->infobar_count()); 878 EXPECT_EQ(0U, infobar_service1->infobar_count());
879 } 879 }
880 } 880 }
881 881
882 IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, IllegalArguments) {
883 // Tests that malformed arguments to connect() don't crash.
884 // Regression test for crbug.com/472700.
885 InitializeTestServer();
886 LoadChromiumConnectableExtension();
887 ui_test_utils::NavigateToURL(browser(), chromium_org_url());
888 bool result;
889 CHECK(content::ExecuteScriptAndExtractBool(
890 browser()->tab_strip_model()->GetActiveWebContents(),
891 "assertions.tryIllegalArguments()", &result));
892 EXPECT_TRUE(result);
893 }
894
882 IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, 895 IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
883 FromIncognitoAllowExtension) { 896 FromIncognitoAllowExtension) {
884 InitializeTestServer(); 897 InitializeTestServer();
885 898
886 scoped_refptr<const Extension> extension = LoadChromiumConnectableExtension(); 899 scoped_refptr<const Extension> extension = LoadChromiumConnectableExtension();
887 900
888 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord( 901 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord(
889 profile()->GetOffTheRecordProfile(), chromium_org_url()); 902 profile()->GetOffTheRecordProfile(), chromium_org_url());
890 content::RenderFrameHost* incognito_frame = 903 content::RenderFrameHost* incognito_frame =
891 incognito_browser->tab_strip_model() 904 incognito_browser->tab_strip_model()
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); 1200 ui_test_utils::NavigateToURL(browser(), chromium_org_url());
1188 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, 1201 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR,
1189 CanConnectAndSendMessagesToMainFrame(invalid.get())); 1202 CanConnectAndSendMessagesToMainFrame(invalid.get()));
1190 } 1203 }
1191 1204
1192 #endif // !defined(OS_WIN) - http://crbug.com/350517. 1205 #endif // !defined(OS_WIN) - http://crbug.com/350517.
1193 1206
1194 } // namespace 1207 } // namespace
1195 1208
1196 }; // namespace extensions 1209 }; // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698