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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_browsertest.cc

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change Created 6 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "chrome/browser/extensions/activity_log/activity_log.h" 6 #include "chrome/browser/extensions/activity_log/activity_log.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/prerender/prerender_handle.h" 9 #include "chrome/browser/prerender/prerender_handle.h"
10 #include "chrome/browser/prerender/prerender_manager.h" 10 #include "chrome/browser/prerender/prerender_manager.h"
(...skipping 20 matching lines...) Expand all
31 // Make sure the activity log is turned on. 31 // Make sure the activity log is turned on.
32 void SetUpCommandLine(CommandLine* command_line) override { 32 void SetUpCommandLine(CommandLine* command_line) override {
33 ExtensionBrowserTest::SetUpCommandLine(command_line); 33 ExtensionBrowserTest::SetUpCommandLine(command_line);
34 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); 34 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging);
35 command_line->AppendSwitchASCII(switches::kPrerenderMode, 35 command_line->AppendSwitchASCII(switches::kPrerenderMode,
36 switches::kPrerenderModeSwitchValueEnabled); 36 switches::kPrerenderModeSwitchValueEnabled);
37 } 37 }
38 38
39 static void Prerender_Arguments( 39 static void Prerender_Arguments(
40 const std::string& extension_id, 40 const std::string& extension_id,
41 int port, 41 uint16 port,
42 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { 42 scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
43 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below 43 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below
44 base::MessageLoop::current()->PostTask( 44 base::MessageLoop::current()->PostTask(
45 FROM_HERE, base::MessageLoop::QuitClosure()); 45 FROM_HERE, base::MessageLoop::QuitClosure());
46 46
47 ASSERT_TRUE(i->size()); 47 ASSERT_TRUE(i->size());
48 scoped_refptr<Action> last = i->front(); 48 scoped_refptr<Action> last = i->front();
49 49
50 ASSERT_EQ(extension_id, last->extension_id()); 50 ASSERT_EQ(extension_id, last->extension_id());
51 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); 51 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type());
52 ASSERT_EQ("[\"/google_cs.js\"]", 52 ASSERT_EQ("[\"/google_cs.js\"]",
53 ActivityLogPolicy::Util::Serialize(last->args())); 53 ActivityLogPolicy::Util::Serialize(last->args()));
54 ASSERT_EQ( 54 ASSERT_EQ(
55 base::StringPrintf("http://www.google.com.bo:%d/test.html", port), 55 base::StringPrintf("http://www.google.com.bo:%u/test.html", port),
56 last->SerializePageUrl()); 56 last->SerializePageUrl());
57 ASSERT_EQ( 57 ASSERT_EQ(
58 base::StringPrintf("www.google.com.bo:%d/test.html", port), 58 base::StringPrintf("www.google.com.bo:%u/test.html", port),
59 last->page_title()); 59 last->page_title());
60 ASSERT_EQ("{\"prerender\":true}", 60 ASSERT_EQ("{\"prerender\":true}",
61 ActivityLogPolicy::Util::Serialize(last->other())); 61 ActivityLogPolicy::Util::Serialize(last->other()));
62 ASSERT_EQ("", last->api_name()); 62 ASSERT_EQ("", last->api_name());
63 ASSERT_EQ("", last->SerializeArgUrl()); 63 ASSERT_EQ("", last->SerializeArgUrl());
64 } 64 }
65 }; 65 };
66 66
67 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { 67 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) {
68 host_resolver()->AddRule("*", "127.0.0.1"); 68 host_resolver()->AddRule("*", "127.0.0.1");
69 ASSERT_TRUE(StartEmbeddedTestServer()); 69 ASSERT_TRUE(StartEmbeddedTestServer());
70 int port = embedded_test_server()->port(); 70 uint16 port = embedded_test_server()->port();
71 71
72 // Get the extension (chrome/test/data/extensions/activity_log) 72 // Get the extension (chrome/test/data/extensions/activity_log)
73 const Extension* ext = 73 const Extension* ext =
74 LoadExtension(test_data_dir_.AppendASCII("activity_log")); 74 LoadExtension(test_data_dir_.AppendASCII("activity_log"));
75 ASSERT_TRUE(ext); 75 ASSERT_TRUE(ext);
76 76
77 ActivityLog* activity_log = ActivityLog::GetInstance(profile()); 77 ActivityLog* activity_log = ActivityLog::GetInstance(profile());
78 ASSERT_TRUE(activity_log); 78 ASSERT_TRUE(activity_log);
79 79
80 //Disable rate limiting in PrerenderManager 80 //Disable rate limiting in PrerenderManager
(...skipping 11 matching lines...) Expand all
92 92
93 content::WebContents* web_contents = 93 content::WebContents* web_contents =
94 browser()->tab_strip_model()->GetActiveWebContents(); 94 browser()->tab_strip_model()->GetActiveWebContents();
95 ASSERT_TRUE(web_contents); 95 ASSERT_TRUE(web_contents);
96 96
97 content::WindowedNotificationObserver page_observer( 97 content::WindowedNotificationObserver page_observer(
98 content::NOTIFICATION_LOAD_STOP, 98 content::NOTIFICATION_LOAD_STOP,
99 content::NotificationService::AllSources()); 99 content::NotificationService::AllSources());
100 100
101 GURL url(base::StringPrintf( 101 GURL url(base::StringPrintf(
102 "http://www.google.com.bo:%d/test.html", 102 "http://www.google.com.bo:%u/test.html",
103 port)); 103 port));
104 104
105 if (!prerender_manager->cookie_store_loaded()) { 105 if (!prerender_manager->cookie_store_loaded()) {
106 base::RunLoop loop; 106 base::RunLoop loop;
107 prerender_manager->set_on_cookie_store_loaded_cb_for_testing( 107 prerender_manager->set_on_cookie_store_loaded_cb_for_testing(
108 loop.QuitClosure()); 108 loop.QuitClosure());
109 loop.Run(); 109 loop.Run();
110 } 110 }
111 111
112 const gfx::Size kSize(640, 480); 112 const gfx::Size kSize(640, 480);
(...skipping 13 matching lines...) Expand all
126 "", 126 "",
127 -1, 127 -1,
128 base::Bind( 128 base::Bind(
129 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); 129 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port));
130 130
131 // Allow invocation of Prerender_Arguments 131 // Allow invocation of Prerender_Arguments
132 base::MessageLoop::current()->Run(); 132 base::MessageLoop::current()->Run();
133 } 133 }
134 134
135 } // namespace extensions 135 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/devtools/remote_debugging_server.cc ('k') | chrome/browser/extensions/api/dial/dial_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698